If something goes wrong and you catch an exception here, what's the best behavior?
Can you heal the exception?
Should you rethrow the exception?
Returning an empty object and/or null is often not the best idea, as the calling method, and thus the user, won't know something went wrong.
As it exists here, you're taking valuable information about what went wrong (the Exception object), ignoring it, and then acting as if the program operated properly. This will be very confusing to the user.
Recommendations:
- Use proper logging, which has the concepts of logging levels.
- Give a useful indication to the user, but not too detailed.
If something goes wrong and you catch an exception here, what's the best behavior?
Can you heal the exception?
Should you rethrow the exception?
Returning an empty object and/or null is often not the best idea, as the calling method, and thus the user, won't know something went wrong.
As it exists here, you're taking valuable information about what went wrong (the Exception object), ignoring it, and then acting as if the program operated properly. This will be very confusing to the user.
Recommendations:
HobbyCollection/src/main/java/com/hobbycollection/HobbyCollectionRESTController.java
Line 104 in b8d9a3d