Search in sources :

Example 31 with Error

use of com.nexblocks.authguard.api.dto.entities.Error 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)31 AccountDTO (com.nexblocks.authguard.api.dto.entities.AccountDTO)9 RequestValidationError (com.nexblocks.authguard.api.dto.entities.RequestValidationError)7 Inject (com.google.inject.Inject)4 AuthRequestDTO (com.nexblocks.authguard.api.dto.requests.AuthRequestDTO)4 RestMapper (com.nexblocks.authguard.rest.mappers.RestMapper)4 BodyHandler (com.nexblocks.authguard.rest.util.BodyHandler)4 IdempotencyHeader (com.nexblocks.authguard.rest.util.IdempotencyHeader)4 Context (io.javalin.http.Context)4 List (java.util.List)4 Optional (java.util.Optional)4 Collectors (java.util.stream.Collectors)4 AuthGuardRoles (com.nexblocks.authguard.api.access.AuthGuardRoles)3 ApiKeyDTO (com.nexblocks.authguard.api.dto.entities.ApiKeyDTO)3 AppDTO (com.nexblocks.authguard.api.dto.entities.AppDTO)3 ActorDomainVerifier (com.nexblocks.authguard.rest.access.ActorDomainVerifier)3 ApplicationsService (com.nexblocks.authguard.service.ApplicationsService)3 CredentialsService (com.nexblocks.authguard.service.CredentialsService)3 IdempotencyException (com.nexblocks.authguard.service.exceptions.IdempotencyException)3 com.nexblocks.authguard.service.model (com.nexblocks.authguard.service.model)3