Search in sources :

Example 1 with ExceptionHandlers

use of com.nexblocks.authguard.rest.exceptions.ExceptionHandlers in project AuthGuard by AuthGuard.

the class ServerExceptionHandlers method configure.

@Override
public void configure(final Javalin app) {
    app.exception(Exception.class, (e, context) -> {
        log.error("An exception was thrown", e);
        final String message = "An error occurred while processing request " + context.method() + " " + context.path();
        context.status(500).json(new Error("", message));
    });
    app.exception(ServiceException.class, ExceptionHandlers::serviceException);
    app.exception(ServiceAuthorizationException.class, ExceptionHandlers::serviceAuthorizationException);
    app.exception(ServiceConflictException.class, ExceptionHandlers::serviceConflictException);
    app.exception(RuntimeJsonException.class, ExceptionHandlers::jsonMappingException);
    app.exception(RequestValidationException.class, ExceptionHandlers::requestValidationException);
    app.exception(IdempotencyException.class, ExceptionHandlers::idempotencyException);
    app.exception(TimeoutException.class, ExceptionHandlers::timeoutException);
    app.exception(CompletionException.class, ExceptionHandlers::completionException);
}
Also used : ExceptionHandlers(com.nexblocks.authguard.rest.exceptions.ExceptionHandlers) Error(com.nexblocks.authguard.api.dto.entities.Error)

Aggregations

Error (com.nexblocks.authguard.api.dto.entities.Error)1 ExceptionHandlers (com.nexblocks.authguard.rest.exceptions.ExceptionHandlers)1