Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Consider an unchecked ServiceException #176

Open
ivan-aguirre opened this issue Jan 11, 2019 · 0 comments
Open

Consider an unchecked ServiceException #176

ivan-aguirre opened this issue Jan 11, 2019 · 0 comments

Comments

@ivan-aguirre
Copy link

Endpoints uses ServiceException to easily return the right Http Codes. Developers can extend it and create their own exceptions.

I would like to suggest a "RuntimeServiceException" for the following reasons:

  • Since ServiceExceptions are checked we need to cascade the handling over the code, usually polluting the code with "throws ServiceException" or similar.

  • Usually ServiceExceptions does not requires special handling other than return the proper HTTP Codes. They could be Runtime Exceptions. Even though exception is runtime the developers could handle them with try / catch blocks.

  • The criticism about Java checked exceptions overuse is known. Old frameworks and APIs used to have checked exceptions everywhere. After some years the frameworks has started to adopt RuntimeExceptions more widely. E.g.: javax.persistence.EntityNotFoundException from JPA is Runtime.

best regards!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant