ews-java-api
ews-java-api copied to clipboard
Remove generic thrown Exceptions
Many of the calls that exist throw generic Exceptions. It would be nice to have more specific Exceptions thrown for any given call.
Generally it would seem that having more verbose / specific exceptions relating to any given error that happens would be better practice (even if it can get a bit messy sometimes).
See Don't Throw Generic Exceptions and Beware the dangers of throwing generic exceptions.
If this was a design choice that's fine. I just wanted to flag this.
Definitely very ugly. It makes proper error handling impossible or at least a pain in the ass. If you want to not handle the error where the method is used and you rethrow, then it will litter the whole call chain with "throws Exception". Workaround: catch where it occurs and wrap into a new EwsException. But it's only a workaround. You still can't distinguish the various error classes this way.
If you're going to throw a "we don't know what could possibly go wrong" exception, we would prefer a runtime exception.
Throwing Exception forces downstream code to deal with InterruptedException which is particularly nasty.