use of uk.gov.ida.common.ExceptionType 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();
}
use of uk.gov.ida.common.ExceptionType in project verify-hub by alphagov.
the class SamlEngineExceptionMapperTest method shouldPassthroughErrorIdAndExceptionType.
@Test
public void shouldPassthroughErrorIdAndExceptionType() throws Exception {
UUID errorId = UUID.randomUUID();
final ExceptionType exceptionType = ExceptionType.IDA_SOAP;
ApplicationException applicationException = createUnauditedException(exceptionType, errorId);
final Response response = samlEngineExceptionMapper.toResponse(applicationException);
assertThat(response.hasEntity()).isTrue();
ErrorStatusDto errorStatusDto = (ErrorStatusDto) response.getEntity();
assertThat(errorStatusDto.getErrorId()).isEqualTo(errorId);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(exceptionType);
checkLogLevel(applicationException.getExceptionType().getLevel());
}
Aggregations