You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Often we have a try-catch block around method bodies that catches all exceptions, logs them at warning level, and simply continues execution flow. This results in a lot of null values to be returned, causing NullPointerExceptions somewhere else in the code (which is hard to debug).
Better throw unchecked exceptions and return only non-null values in success cases (e.g., when sending e-mail notifications, only the top level function should catch exceptions to avoid one recipient canceling the delivery of all other emails). However, when an exception occurs during e-mail content generation (e.g., generateAdditionalObject in NotificationDispatcherImpl) this is an unexpected exception and should be thrown to a higher level method (instead of returning null).
This is just one example of bad exception handling in Requirements Bazaar, so we should work through different parts of the code from time to time to refactor!
The text was updated successfully, but these errors were encountered:
Often we have a
try-catch
block around method bodies that catches all exceptions, logs them at warning level, and simply continues execution flow. This results in a lot ofnull
values to be returned, causingNullPointerException
s somewhere else in the code (which is hard to debug).Better throw unchecked exceptions and return only non-null values in success cases (e.g., when sending e-mail notifications, only the top level function should catch exceptions to avoid one recipient canceling the delivery of all other emails). However, when an exception occurs during e-mail content generation (e.g.,
generateAdditionalObject
inNotificationDispatcherImpl
) this is an unexpected exception and should be thrown to a higher level method (instead of returning null).This is just one example of bad exception handling in Requirements Bazaar, so we should work through different parts of the code from time to time to refactor!
The text was updated successfully, but these errors were encountered: