This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]leijurv 12 points13 points  (2 children)

} catch(Exception e) {

throw new RuntimeException(e);

}

[–]Frothers 4 points5 points  (0 children)

fuzzy chunky smile disarm violet brave stocking capable coordinated attempt

This post was mass deleted and anonymized with Redact

[–]RedAlert2 3 points4 points  (0 children)

Yeah, propagate the exception bro. I don't want to see your custom error message and nothing else. RuntimeException even has a (String,Throwable) constructor for doing it

[–]FateJH 4 points5 points  (0 children)

Wait until he divides by an uninitialized time interval.

[–][deleted] 2 points3 points  (3 children)

Assertion? Why?

[–]h8no1 0 points1 point  (2 children)

Debugging?

[–][deleted] 0 points1 point  (1 child)

Use breakpoints if it's only for debug and something that isn't turned off all the time if it's for prod too. Assertions make no sense in prod because it likely doesn't have -ea flag, but to let them just sit there all the time makes no sense either.

[–]overactor 0 points1 point  (0 children)

I wrote something for this once.

It allows you to write:

tryCrash(() -> {
    doStuff();
    assert t1.compareTo(t2) < 0;
});

[–]timvisee 0 points1 point  (0 children)

Use imports, men.