POC of error handling#8
POC of error handling#8mynomoto wants to merge 1 commit intoclj-easy:mainfrom mynomoto:error-handling
Conversation
|
@mynomoto That's an interesting problem and approach, I hadn't thought about uniform error handling yet. Perhaps functions should be wrapped in a catch-all macro that just returns the original exception in an ex-info? Or perhaps callers should always catch |
|
@borkdude I think that there are always tradeoffs 😉 How I see this atm:
I don't think that this is very important here because in a certain way invalid json is in the end invalid, the effect is the same as in the app cannot process it. This type of discussion will be more important for an http client because connection errors and timeouts are different in important ways. Another advantage to having errors defined in this library is making testing easier because we could expose functions that construct the exceptions so users can simulate errors in json processing easily. |
This is only a poc of how I suggest we handle errors. Here we catch and rethrow an
ex-infowith the original exception as the cause. If the user only uses the top level exception they can replace implementations without having to redo the error handling on the application.WDYT?