@Test public void testBadRequestWithRemoteApiException() { RemoteApiException ex = new RemoteApiException(HttpStatus.BAD_REQUEST.value(), "test"); assertEquals(HttpStatus.BAD_REQUEST, exceptionHandler.handleRemoteAPIException(ex).getStatusCode()); }
@ResponseBody @ExceptionHandler({RemoteApiException.class}) public ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex) { String message = ex.getMessage(); LOGGER.error(message, ex); int status = ex.getCode(); ErrorResponse errorResponse = buildErrorResponse(status, message); return ResponseEntity.status(status).body(errorResponse); }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler({RemoteApiException.class}) public ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex) { String message = ex.getMessage(); LOGGER.error(message, ex); int status = ex.getCode(); ErrorResponse errorResponse = buildErrorResponse(status, message); return ResponseEntity.status(status).body(errorResponse); } }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler({RemoteApiException.class}) public ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex) { String message = ex.getMessage(); LOGGER.error(message, ex); int status = ex.getCode(); ErrorResponse errorResponse = buildErrorResponse(status, message); return ResponseEntity.status(status).body(errorResponse); }  }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler({RemoteApiException.class}) public ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex) { String message = ex.getMessage(); LOGGER.error(message, ex); int status = ex.getCode(); ErrorResponse errorResponse = buildErrorResponse(status, message); return ResponseEntity.status(status).body(errorResponse); }  @ResponseBody @ExceptionHandler(IntegrationUnavailableException.class) ResponseEntity<ErrorResponse> handleUnavailableException(IntegrationUnavailableException ex); @ResponseBody @ExceptionHandler({RemoteApiException.class}) ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex); @ResponseBody @ExceptionHandler(UnauthorizedUserException.class) ResponseEntity<ErrorResponse> handleUnauthorizedException(UnauthorizedUserException ex); @ResponseBody @ExceptionHandler({ ForbiddenAuthException.class, UnregisteredAppAuthException.class }) ResponseEntity<ErrorResponse> handleForbiddenException(AuthenticationException ex); @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex); }
WebResourceExceptionHandler { @ResponseBody @ExceptionHandler({RemoteApiException.class}) public ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex) { String message = ex.getMessage(); LOGGER.error(message, ex); int status = ex.getCode(); ErrorResponse errorResponse = buildErrorResponse(status, message); return ResponseEntity.status(status).body(errorResponse); }  @ResponseBody @ExceptionHandler(IntegrationUnavailableException.class) ResponseEntity<ErrorResponse> handleUnavailableException(IntegrationUnavailableException ex); @ResponseBody @ExceptionHandler({RemoteApiException.class}) ResponseEntity<ErrorResponse> handleRemoteAPIException(RemoteApiException ex); @ResponseBody @ExceptionHandler(UnauthorizedUserException.class) ResponseEntity<ErrorResponse> handleUnauthorizedException(UnauthorizedUserException ex); @ResponseBody @ExceptionHandler({ ForbiddenAuthException.class, UnregisteredAppAuthException.class }) ResponseEntity<ErrorResponse> handleForbiddenException(AuthenticationException ex); @ResponseBody @ExceptionHandler(MissingRequiredParameterException.class) ResponseEntity<ErrorResponse> handleMissingRequiredParameterException(MissingRequiredParameterException ex);  }