Search in sources :

Example 1 with DataRepoException

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);
}
Also used : DataRepoException(bio.terra.common.exception.DataRepoException) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Aggregations

DataRepoException (bio.terra.common.exception.DataRepoException)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1