Created
August 7, 2019 13:26
-
-
Save amiremohamadi/282cd2d32734f4709b79e6823f2e1a67 to your computer and use it in GitHub Desktop.
YO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.rahnema.college.team3.auctionak.controllers; | |
| import org.omg.CORBA.Object; | |
| import org.springframework.http.HttpHeaders; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.ControllerAdvice; | |
| import org.springframework.web.bind.annotation.ExceptionHandler; | |
| import org.springframework.web.context.request.WebRequest; | |
| @ControllerAdvice | |
| public class ExceptionController { | |
| @ExceptionHandler({RuntimeException.class}) | |
| public ResponseEntity<?> handleRuntimeException(Exception ex, WebRequest req) { | |
| return new ResponseEntity<>( | |
| ex.getMessage(), new HttpHeaders(), HttpStatus.FORBIDDEN | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment