Created
April 28, 2020 02:17
-
-
Save CheolhoJeon/77da014f24812ba1aa7b2c1fa6fbb4a9 to your computer and use it in GitHub Desktop.
This file contains 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 controller; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.ExceptionHandler; | |
import org.springframework.web.bind.annotation.RestControllerAdvice; | |
import spring.MemberNotFoundException; | |
@RestControllerAdvice("controller") | |
public class ApiExceptionAdvice { | |
@ExceptionHandler(MemberNotFoundException.class) | |
public ResponseEntity<Object> handleNoData() { | |
return ResponseEntity | |
.status(HttpStatus.NOT_FOUND) | |
.body(new ErrorResponse("no member")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment