use of bio.terra.common.exception.DataRepoException in project jade-data-repo by DataBiosphere.
the class GlobalExceptionHandler method samApiExceptionHandler.
@ExceptionHandler(ApiException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public ErrorModel samApiExceptionHandler(ApiException ex) {
// All SAM ApiExceptions should be caught inside the service/iam package and converted to a DataRepo exception
// there. If any ApiException makes it up to this level, then it's unexpected. We can still do the conversion,
// but want to add in a logging message that there's an escaped SAM ApiException somewhere.
logger.error("SAM ApiException caught outside the service/iam package", ex);
DataRepoException drex = SamIam.convertSAMExToDataRepoEx(ex);
return buildErrorModel(drex);
}
Aggregations