diesieben07
09/03/2017, 12:15 PMrequire
throws IllegalArgumentException
, which makes no sense here, the arguments passed in to my methods were perfectly fine.ilya.gorbunov
09/03/2017, 4:42 PMdiesieben07
09/03/2017, 6:11 PMRuntimeException
, which is the most reasonable thing you can do, I think.ilya.gorbunov
09/03/2017, 9:09 PMAssertionError
— when the returned value doesn't meet the function contract.diesieben07
09/03/2017, 9:34 PMAssertionError
here, since that seems to be only for the assert
keyword.dagguh
09/05/2017, 6:39 AMrequire
.
Do you have a exception-type-specific try-catch logic? Limit the try
scope and you’ll know what failed on your abstraction level. Or use return values instead of data-carrying exceptions.
Do you want the exception to explain the error? Let the exception message and stacktrace do it for you.diesieben07
09/05/2017, 1:37 PMException
would do. It's just that IllegalArgumentException
and IlegalStateException
are not appropriate, just like IOException
isn't.