I recently reviewed some code which converted gRPC error codes into custom errors using a decorator and the simplicity and genius of it made me facepalm “why didn’t I think of it myself?”.
Really, why didn’t I? When I wrote how to handle errors with grace I mentioned using decorators to validate input parameters and how important it was to keep error handling separate from your main code as much as possible. I just didn’t think to combine the two. Oh well, better late than never.
Continue reading