use of org.springframework.web.bind.annotation.ExceptionHandler in project ArachneCentralAPI by OHDSI.
the class ExceptionHandlingController method exceptionHandler.
@ExceptionHandler(Exception.class)
public ResponseEntity<JsonResult> exceptionHandler(Exception ex) {
LOGGER.error(ex.getMessage(), ex);
JsonResult result = new JsonResult<>(SYSTEM_ERROR);
result.setErrorMessage(ex.getMessage());
return new ResponseEntity<>(result, HttpStatus.OK);
}
use of org.springframework.web.bind.annotation.ExceptionHandler in project ArachneCentralAPI by OHDSI.
the class ExceptionHandlingController method exceptionHandler.
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(ServiceNotAvailableException.class)
@ResponseBody
public JsonResult exceptionHandler(ServiceNotAvailableException ex) {
LOGGER.warn(ex.getMessage());
JsonResult result = new JsonResult(SYSTEM_ERROR);
result.setErrorMessage(ex.getMessage());
return result;
}
use of org.springframework.web.bind.annotation.ExceptionHandler in project ArachneCentralAPI by OHDSI.
the class ExceptionHandlingController method exceptionHandler.
@ExceptionHandler(PermissionDeniedException.class)
public ResponseEntity<JsonResult> exceptionHandler(PermissionDeniedException ex) {
LOGGER.error(ex.getMessage(), ex);
JsonResult result = new JsonResult<>(PERMISSION_DENIED);
result.setErrorMessage(ex.getMessage());
return new ResponseEntity<>(result, HttpStatus.OK);
}
use of org.springframework.web.bind.annotation.ExceptionHandler in project ArachneCentralAPI by OHDSI.
the class ExceptionHandlingController method exceptionHandler.
@ExceptionHandler(IORuntimeException.class)
public ResponseEntity<JsonResult> exceptionHandler(IORuntimeException ex) {
LOGGER.error(ex.getMessage(), ex);
JsonResult result = new JsonResult<>(SYSTEM_ERROR);
result.setErrorMessage(ex.getMessage());
return new ResponseEntity<>(result, HttpStatus.OK);
}
use of org.springframework.web.bind.annotation.ExceptionHandler in project ArachneCentralAPI by OHDSI.
the class ExceptionHandlingController method exceptionHandler.
@ExceptionHandler(AccessDeniedException.class)
public ResponseEntity<JsonResult> exceptionHandler(AccessDeniedException ex) {
LOGGER.error(ex.getMessage());
JsonResult result = new JsonResult<>(PERMISSION_DENIED);
result.setErrorMessage(ex.getMessage());
return new ResponseEntity<>(result, HttpStatus.OK);
}
Aggregations