rest controller practice : 로그인, jwt생성

This commit is contained in:
haerong22
2021-03-15 19:37:45 +09:00
parent 895ef4732d
commit 0e7bfbf018
6 changed files with 92 additions and 16 deletions

View File

@@ -1,6 +1,8 @@
package com.example.restcontroller;
import com.example.restcontroller.board.exception.BoardTypeNotFoundException;
import com.example.restcontroller.common.exception.BizException;
import com.example.restcontroller.common.model.ResponseResult;
import com.example.restcontroller.notice.exception.AlreadyDeletedException;
import com.example.restcontroller.notice.exception.DuplicateNoticeException;
import com.example.restcontroller.notice.exception.NoticeNotFoundException;
@@ -22,9 +24,10 @@ public class GlobalExceptionHandler {
UserNotFoundException.class,
ExistsEmailException.class,
PasswordNotMatchException.class,
BoardTypeNotFoundException.class })
BoardTypeNotFoundException.class,
BizException.class })
public ResponseEntity<?> badRequest(RuntimeException e) {
return new ResponseEntity<>(ResponseMessage.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
return ResponseResult.fail(e.getMessage());
}
@ExceptionHandler(DataIntegrityViolationException.class)
@@ -39,6 +42,6 @@ public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
public ResponseEntity<?> exception(Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.OK);
return ResponseResult.fail(e.getMessage());
}
}