New answers tagged exceptions
1
vote
Java Exception Error Enumerations Anti-pattern
Every time some new exception conditional is dreamed up, then the enumeration has to be updated.
Well, this question is slightly orthogonal to exceptions. If you have a (large) set of error codes, do ...
- 7,363
0
votes
Java Exception Error Enumerations Anti-pattern
Usually an enum should have few values, but in the end as many as needed. For example an enum for specifying system colours could have a large number of values, but that isn’t a problem.
One enum ...
- 40.4k
2
votes
Java Exception Error Enumerations Anti-pattern
So much work when it could just be:
public class InvalidDataFormatException extends GenericExampleException {}
public class MissingRequiredFieldException extends GenericExampleException {}
public ...
- 97.7k
3
votes
Accepted
Java Exception Error Enumerations Anti-pattern
It implies callers should explicitly deal with each possible type, which makes the client exception handling tedious.
Yes, your calling code has to catch each and every Exception, then work out (from ...
- 11.8k
5
votes
Java Exception Error Enumerations Anti-pattern
You haven't talked about proposed alternatives to this approach so I'll answer in generalities that may not be relevant to you in a particular situation. Usually, I would expect something like this ...
- 24.5k
Top 50 recent answers are included
Related Tags
exceptions × 752java × 143
c# × 83
error-handling × 68
c++ × 48
design × 43
.net × 38
python × 37
programming-practices × 30
design-patterns × 27
php × 26
logging × 22
object-oriented × 18
architecture × 15
coding-style × 15
language-agnostic × 14
object-oriented-design × 12
null × 12
api-design × 11
language-design × 11
validation × 11
rest × 10
clean-code × 10
unit-testing × 9
programming-languages × 8