Skip to main content
16 events
when toggle format what by license comment
Feb 26 at 12:10 answer added Phill W. timeline score: 0
Feb 26 at 10:56 comment added Basilevs Aggregated errors are nice to view in UI, but are a nightmare to handle programmatically.
Feb 26 at 10:34 history protected gnat
Jan 22 at 10:48 comment added Torben Have you considered using a validation framework like Jakarta Validation? It seems to me like it would meet your needs completely. Here you would have a "takeoff validation group" that defines the constraints for takeoff operation.
Jan 16 at 14:26 answer added gnasher729 timeline score: 2
Jan 10 at 21:23 answer added user462567 timeline score: 1
Jan 10 at 20:54 comment added Frank Hopkins this sounds like you might want to use the debugger instead - unless you mean enduser trying to use your program instead? then imho the validation of input parameters should be at the top level and deep down exceptions would only be a fallback in case the first input parameter validation fails
Jan 10 at 18:20 comment added EarthTurtle @FrankHopkins This would be regarding debugging, throwing IllegalArgument at the first precondition that fails means there could be other issues with the arguments, but the caller wouldn't know until they do their fix and run it again. The goal is to fix any issues in the fewest number of runs/calls.
Jan 10 at 10:28 comment added Caleth Failing fast has benefits of it's own, later checks can be moot if earlier checks fail. E.g. if spaceship is null, then none of the other validations are appropriate.
Jan 10 at 2:35 comment added Frank Hopkins why would you say this is tedious for the caller? is this about debugging or handling the exception?
Jan 10 at 1:15 answer added candied_orange timeline score: 5
Jan 9 at 22:50 comment added Doc Brown Separate the validation and throwing of exceptions. Make checkArgument insert a message and/or an exception into some ArrayList of exceptions (instead of throwing), and when all validations happened, throw a collective exception in case the ArrayList isn't empty. That way, each validation by checkArgument is still a one-liner, not a full try-catch-if-else ceremony.
Jan 9 at 21:59 comment added Greg Burghardt In .NET, the AggregateException class might work for your needs. It is basically an exception representing a collection of exceptions. Maybe build something like that in Java?
Jan 9 at 20:34 review Close votes
Jan 10 at 13:35
S Jan 9 at 20:05 review First questions
Jan 10 at 8:02
S Jan 9 at 20:05 history asked EarthTurtle CC BY-SA 4.0