The WRONG Use of 'Exception'

preview_player
Показать описание


#java #programming #softwaredeveloper #shorts
Рекомендации по теме
Комментарии
Автор

with spring, to make it more clean you can make a ExceptionHandlerAdvice class to catch every exception in a centralized point to avoid extending here and there, this is also useful to return a common response with different status codes, messages, etc..

sharkpyro
Автор

This is wrong imo. You should only use runtime exception when you encounter a situation where you have no plan B. Not finding a user is a basic usecase that should be handled normally. Having runtime exception everywhere is basically going javascript mode where no function as to handle any errors

sylvereleipertz
Автор

Love this tip! thank you! Working on an API right now :)

yourratking