|
13 | 13 | @Slf4j
|
14 | 14 | public class ApiExceptionV2Controller {
|
15 | 15 |
|
16 |
| - @ResponseStatus(HttpStatus.BAD_REQUEST) |
17 |
| - @ExceptionHandler(IllegalArgumentException.class) //생략가능 - 매개변수로 지정가능 |
18 |
| - public ErrorResult illegalExHandler(IllegalArgumentException e) { |
19 |
| - log.error("[exceptionHandler] ex", e); |
20 |
| - return new ErrorResult("BAD", e.getMessage()); |
21 |
| - } |
22 |
| - |
23 |
| - @ExceptionHandler |
24 |
| - public ResponseEntity<ErrorResult> userHandler(UserException e) { |
25 |
| - log.error("[exceptionHandler] ex", e); |
26 |
| - ErrorResult errorResult = new ErrorResult("USER-EX", e.getMessage()); |
27 |
| - return new ResponseEntity(errorResult, HttpStatus.BAD_REQUEST); |
28 |
| - } |
29 |
| - |
30 |
| - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) //IllegalArgumentException, UserException을 제외한 예외는 여기서! |
31 |
| - @ExceptionHandler |
32 |
| - public ErrorResult exHandler(Exception e) { |
33 |
| - log.error("[exception] ex", e); |
34 |
| - return new ErrorResult("EX", e.getMessage()); |
35 |
| - } |
| 16 | +// @ResponseStatus(HttpStatus.BAD_REQUEST) |
| 17 | +// @ExceptionHandler(IllegalArgumentException.class) //생략가능 - 매개변수로 지정가능 |
| 18 | +// public ErrorResult illegalExHandler(IllegalArgumentException e) { |
| 19 | +// log.error("[exceptionHandler] ex", e); |
| 20 | +// return new ErrorResult("BAD", e.getMessage()); |
| 21 | +// } |
| 22 | +// |
| 23 | +// @ExceptionHandler |
| 24 | +// public ResponseEntity<ErrorResult> userHandler(UserException e) { |
| 25 | +// log.error("[exceptionHandler] ex", e); |
| 26 | +// ErrorResult errorResult = new ErrorResult("USER-EX", e.getMessage()); |
| 27 | +// return new ResponseEntity(errorResult, HttpStatus.BAD_REQUEST); |
| 28 | +// } |
| 29 | +// |
| 30 | +// @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) //IllegalArgumentException, UserException을 제외한 예외는 여기서! |
| 31 | +// @ExceptionHandler |
| 32 | +// public ErrorResult exHandler(Exception e) { |
| 33 | +// log.error("[exception] ex", e); |
| 34 | +// return new ErrorResult("EX", e.getMessage()); |
| 35 | +// } |
36 | 36 |
|
37 | 37 | @GetMapping("/api2/members/{id}")
|
38 | 38 | public MemberDto getMember(@PathVariable("id") String id) {
|
@@ -60,4 +60,5 @@ static class MemberDto {
|
60 | 60 | private String memberId;
|
61 | 61 | private String name;
|
62 | 62 | }
|
| 63 | + |
63 | 64 | }
|
0 commit comments