Skip to content

Creating and Throwing Exceptions

Bria Morgan edited this page Sep 13, 2022 · 3 revisions

Avoid repetition by using custom exception classes with an appropriate HTTPStatus and a clear message. Custom exception classes should be located in service/src/main/java/org.databiosphere.workspacedataservice/service/model/exception, extend RuntimeException and should use the @ResponseStatus annotation. See MissingReferencedTableException for an example. Any non-custom exceptions should be thrown as a ResponseStatusException with an appropriate HTTPStatus and a clear message.