use of uk.gov.ida.common.ErrorStatusDto in project verify-hub by alphagov.
the class SamlMessageReceiverApiResourceTest method assertError.
private void assertError(final Response response, final ExceptionType exceptionType) {
assertThat(response.getStatus()).isEqualTo(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
ErrorStatusDto entity = response.readEntity(ErrorStatusDto.class);
assertThat(entity.getErrorId()).isNotNull();
assertThat(entity.getExceptionType()).isEqualTo(exceptionType);
}
use of uk.gov.ida.common.ErrorStatusDto in project verify-hub by alphagov.
the class EidasNotSupportedExceptionMapper method handleException.
@Override
public Response handleException(EidasNotSupportedException exception) {
UUID errorId = UUID.randomUUID();
LOG.warn(LogFormatter.formatLog(errorId, exception.getMessage()), exception);
eventLogger.logErrorEvent(errorId, getSessionId().or(SessionId.SESSION_ID_DOES_NOT_EXIST_YET), exception.getMessage());
ErrorStatusDto entity = ErrorStatusDto.createAuditedErrorStatus(errorId, ExceptionType.EIDAS_DISABLED, exception.getMessage());
return Response.status(Response.Status.BAD_REQUEST).entity(entity).build();
}
use of uk.gov.ida.common.ErrorStatusDto in project verify-hub by alphagov.
the class EidasCountryNotSupportedExceptionMapper method handleException.
@Override
public Response handleException(EidasCountryNotSupportedException exception) {
UUID errorId = UUID.randomUUID();
LOG.warn(LogFormatter.formatLog(errorId, exception.getMessage()), exception);
eventLogger.logErrorEvent(errorId, getSessionId().or(SessionId.SESSION_ID_DOES_NOT_EXIST_YET), exception.getMessage());
ErrorStatusDto entity = ErrorStatusDto.createAuditedErrorStatus(errorId, ExceptionType.EIDAS_COUNTRY_NOT_SUPPORTED, exception.getMessage());
return Response.status(Response.Status.BAD_REQUEST).entity(entity).build();
}
use of uk.gov.ida.common.ErrorStatusDto in project verify-hub by alphagov.
the class StateProcessingValidationExceptionMapper method handleException.
@Override
public Response handleException(StateProcessingValidationException exception) {
UUID errorId = UUID.randomUUID();
LOG.log(exception.getLevel(), exception, errorId);
eventLogger.logErrorEvent(errorId, getSessionId().orElse(SessionId.SESSION_ID_DOES_NOT_EXIST_YET), exception.getMessage());
ErrorStatusDto entity = createUnauditedErrorStatus(errorId, STATE_PROCESSING_VALIDATION);
return Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON_TYPE).entity(entity).build();
}
use of uk.gov.ida.common.ErrorStatusDto in project verify-hub by alphagov.
the class InvalidSessionStateExceptionMapper method handleException.
@Override
public Response handleException(InvalidSessionStateException exception) {
UUID errorId = UUID.randomUUID();
LOG.warn(LogFormatter.formatLog(errorId, exception.getMessage()), exception);
eventLogger.logErrorEvent(errorId, getSessionId().orElse(SessionId.SESSION_ID_DOES_NOT_EXIST_YET), exception.getMessage());
ExceptionType type = getExceptionType(exception);
ErrorStatusDto entity = ErrorStatusDto.createAuditedErrorStatus(errorId, type, exception.getMessage());
return Response.status(Response.Status.BAD_REQUEST).entity(entity).build();
}
Aggregations