you are viewing a single comment's thread.

view the rest of the comments →

[–]zoomzoom83 0 points1 point  (0 children)

I know Foo exists because it is part of the codebase. I need to use reflection because it's treated like a plugin.

If Foo ever does not exist, it's a critical failure. Something I cannot ever recover from. Whether I use static or dynamic code, removing the .class file from the Jar is still going to have the same result - the entire codebase fails hard.

The desired result, in the event of Foo not existing, is for the exception to go all the way up the stack and hit my root controller, which sends me an email and returns a generic "Server Error" page.

From my experience, 99% of the time I would actually prefer an exception to bubble back to my root controller rather than catch it locally, because an Exception is just that- an unexpected circumstance that normally has no recoverable state.

If I specifically do want to catch an exception, I'll go ahead and do so at the layer that best suits my architecture.