I've run into a debate between a few friends and I. They prefer general exceptions such as
ServerErrorException with detail as fields of the exception, whereas I prefer making things more specific. For example, I might have a handful of exceptions like:
Each of these built based on the error code returned from the API.
Following Advantages of Exceptions this seems idiomatic to Java. However, my friends' opinion is not exactly uncommon.
Is there a preferred way in terms of code readability and API usability, or does it really just come down to preference?