Class UnexpectedExceptionMapper
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.providers.UnexpectedExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<Exception>
@Provider
public class UnexpectedExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<Exception>
Global JAX-RS
ExceptionMapper for any exception no more specific mapper handles
(ResourceRegistryExceptionMapper, WebApplicationExceptionMapper): a
500 Internal Server Error with the service's JSON error body instead of the container's
HTML page.
The stack trace is logged; the body carries only the generic message, never the exception's own, which may expose internals.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsetoResponse(Exception exception) Maps the given exception to a500 Internal Server Errorwith the generic JSON error body.
-
Constructor Details
-
UnexpectedExceptionMapper
public UnexpectedExceptionMapper()
-
-
Method Details
-
toResponse
Maps the given exception to a500 Internal Server Errorwith the generic JSON error body.- Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<Exception>- Parameters:
exception- the exception to map- Returns:
- the mapped HTTP error response
-