Class GlobalExceptionMapper
java.lang.Object
ai.pipestream.module.pipelineprobe.GlobalExceptionMapper
Global exception mapper that captures unhandled errors, records them in
LastErrorTracker, and returns a structured JSON 500 response.
WebApplicationException (404s, etc.) are re-thrown to preserve normal JAX-RS behavior.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponsemapUnexpectedErrors(Throwable throwable) Maps an unhandled throwable to an HTTP response.
-
Constructor Details
-
GlobalExceptionMapper
public GlobalExceptionMapper()Creates the global exception mapper. Instances are managed by the JAX-RS runtime.
-
-
Method Details
-
mapUnexpectedErrors
Maps an unhandled throwable to an HTTP response.A
WebApplicationExceptionis unwrapped and its own response is returned unchanged, preserving normal JAX-RS behavior (e.g. 404s). AnIllegalArgumentExceptionis mapped to a400 Bad Requestcarrying the exception message. Any other throwable is recorded inLastErrorTracker(keyed by the top stack-trace frame), logged, and returned as a structured JSON500 Internal Server Error.- Parameters:
throwable- the unhandled error raised while processing the request- Returns:
- the JAX-RS response to send to the client
-