is there a proper way to handle multiple errors/exceptions?
Posted
by
toPeerOrNotToPeer
on Stack Overflow
See other posts from Stack Overflow
or by toPeerOrNotToPeer
Published on 2012-12-15T17:01:13Z
Indexed on
2012/12/15
17:03 UTC
Read the original article
Hit count: 190
in OO programming, is there some conceptual pattern, ideas, about handling multiple errors?
for example, i have a method that performs some checks and should return an error message for each error found
['name is too short', 'name contains invalid unicode sequences', 'name is too long']
now, should i use an array of exceptions (not thrown exceptions)?
or something like this is better:
class MyExceptionList extends Exception{
public Void addException(Exception e){}
public Array getExceptions(){}
}
any theory behind this argument will be appreciated!
(this isn't a request about a specific programming language, but a pure theoretical one)
thank you in advance
© Stack Overflow or respective owner