Skip to content

Commit f623dda

Browse files
author
github-actions
committed
chore: Java 스타일 수정
1 parent b64ea43 commit f623dda

File tree

9 files changed

+19
-30
lines changed

9 files changed

+19
-30
lines changed

backend/src/main/java/io/f1/backend/global/exception/errorcode/AuthErrorCode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum AuthErrorCode implements ErrorCode {
10-
1111
UNAUTHORIZED("E401001", HttpStatus.UNAUTHORIZED, "로그인이 필요합니다."),
1212
AUTH_SESSION_NOT_FOUND("E401002", HttpStatus.UNAUTHORIZED, "세션이 존재하지 않습니다. 로그인 후 이용해주세요."),
1313
AUTH_SESSION_EXPIRED("E401003", HttpStatus.UNAUTHORIZED, "세션이 만료되었습니다. 다시 로그인해주세요."),
@@ -21,5 +21,4 @@ public enum AuthErrorCode implements ErrorCode {
2121
private final HttpStatus httpStatus;
2222

2323
private final String message;
24-
2524
}

backend/src/main/java/io/f1/backend/global/exception/errorcode/CommonErrorCode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum CommonErrorCode implements ErrorCode {
10-
1111
BAD_REQUEST_DATA("E400001", HttpStatus.BAD_REQUEST, "잘못된 요청 데이터입니다."),
1212
INVALID_PAGINATION("E400006", HttpStatus.BAD_REQUEST, "page와 size는 1 이상의 정수여야 합니다."),
13-
INTERNAL_SERVER_ERROR("E500001", HttpStatus.INTERNAL_SERVER_ERROR, "서버에러가 발생했습니다. 관리자에게 문의해주세요.");
13+
INTERNAL_SERVER_ERROR(
14+
"E500001", HttpStatus.INTERNAL_SERVER_ERROR, "서버에러가 발생했습니다. 관리자에게 문의해주세요.");
1415

1516
private final String code;
1617

backend/src/main/java/io/f1/backend/global/exception/errorcode/ErrorCode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ public interface ErrorCode {
99
HttpStatus getHttpStatus();
1010

1111
String getMessage();
12-
1312
}

backend/src/main/java/io/f1/backend/global/exception/errorcode/QuestionErrorCode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum QuestionErrorCode implements ErrorCode {
10-
1111
QUESTION_NOT_FOUND("E404003", HttpStatus.NOT_FOUND, "존재하지 않는 문제입니다.");
1212

1313
private final String code;
1414

1515
private final HttpStatus httpStatus;
1616

1717
private final String message;
18-
1918
}

backend/src/main/java/io/f1/backend/global/exception/errorcode/QuizErrorCode.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum QuizErrorCode implements ErrorCode {
10-
1111
FILE_SIZE_TOO_LARGE("E400005", HttpStatus.BAD_REQUEST, "파일 크기가 너무 큽니다."),
1212
UNSUPPORTED_MEDIA_TYPE("E415001", HttpStatus.UNSUPPORTED_MEDIA_TYPE, "지원하지 않는 파일 형식입니다."),
1313
INVALID_FILTER("E400007", HttpStatus.BAD_REQUEST, "title 또는 creator 중 하나만 입력 가능합니다."),
@@ -18,5 +18,4 @@ public enum QuizErrorCode implements ErrorCode {
1818
private final HttpStatus httpStatus;
1919

2020
private final String message;
21-
2221
}

backend/src/main/java/io/f1/backend/global/exception/errorcode/RoomErrorCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum RoomErrorCode implements ErrorCode {
10-
1111
ROOM_USER_LIMIT_REACHED("E403002", HttpStatus.FORBIDDEN, "정원이 모두 찼습니다."),
1212
ROOM_GAME_IN_PROGRESS("E403003", HttpStatus.FORBIDDEN, "게임이 진행 중 입니다."),
1313
ROOM_NOT_FOUND("E404005", HttpStatus.NOT_FOUND, "존재하지 않는 방입니다."),

backend/src/main/java/io/f1/backend/global/exception/errorcode/UserErrorCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import lombok.Getter;
44
import lombok.RequiredArgsConstructor;
5+
56
import org.springframework.http.HttpStatus;
67

78
@Getter
89
@RequiredArgsConstructor
910
public enum UserErrorCode implements ErrorCode {
10-
1111
NICKNAME_EMPTY("E400002", HttpStatus.BAD_REQUEST, "닉네임은 필수 입력입니다."),
1212
NICKNAME_TOO_LONG("E400003", HttpStatus.BAD_REQUEST, "닉네임은 6글자 이하로 입력해야 합니다."),
1313
NICKNAME_NOT_ALLOWED("E400004", HttpStatus.BAD_REQUEST, "한글, 영문, 숫자만 입력해주세요."),

backend/src/main/java/io/f1/backend/global/exception/handler/GlobalExceptionHandler.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.f1.backend.global.exception.errorcode.CommonErrorCode;
55
import io.f1.backend.global.exception.errorcode.ErrorCode;
66
import io.f1.backend.global.exception.response.ErrorResponse;
7+
78
import org.springframework.http.ResponseEntity;
89
import org.springframework.validation.FieldError;
910
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -17,40 +18,32 @@ public class GlobalExceptionHandler {
1718
public ResponseEntity<ErrorResponse> handleCustomException(CustomException e) {
1819
ErrorCode errorCode = e.getErrorCode();
1920

20-
ErrorResponse response = new ErrorResponse(
21-
errorCode.getCode(),
22-
errorCode.getMessage()
23-
);
21+
ErrorResponse response = new ErrorResponse(errorCode.getCode(), errorCode.getMessage());
2422
return new ResponseEntity<>(response, errorCode.getHttpStatus());
2523
}
2624

2725
@ExceptionHandler(Exception.class)
2826
public ResponseEntity<ErrorResponse> handleException(Exception e) {
2927
CommonErrorCode errorCode = CommonErrorCode.INTERNAL_SERVER_ERROR;
3028

31-
ErrorResponse response = new ErrorResponse(
32-
errorCode.getCode(),
33-
errorCode.getMessage()
34-
);
29+
ErrorResponse response = new ErrorResponse(errorCode.getCode(), errorCode.getMessage());
3530
return new ResponseEntity<>(response, errorCode.getHttpStatus());
3631
}
3732

3833
@ExceptionHandler(MethodArgumentNotValidException.class)
39-
public ResponseEntity<ErrorResponse> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
34+
public ResponseEntity<ErrorResponse> handleMethodArgumentNotValidException(
35+
MethodArgumentNotValidException e) {
4036

4137
CommonErrorCode code = CommonErrorCode.BAD_REQUEST_DATA;
4238

43-
String message = e.getBindingResult().getFieldErrors().stream()
44-
.map(FieldError::getDefaultMessage)
45-
.findFirst()
46-
.orElse(code.getMessage());
39+
String message =
40+
e.getBindingResult().getFieldErrors().stream()
41+
.map(FieldError::getDefaultMessage)
42+
.findFirst()
43+
.orElse(code.getMessage());
4744

48-
ErrorResponse response = new ErrorResponse(
49-
code.getCode(),
50-
message
51-
);
45+
ErrorResponse response = new ErrorResponse(code.getCode(), message);
5246

5347
return new ResponseEntity<>(response, code.getHttpStatus());
54-
5548
}
5649
}

backend/src/main/java/io/f1/backend/global/exception/response/ErrorResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ public class ErrorResponse {
99

1010
private final String code;
1111
private final String message;
12-
1312
}

0 commit comments

Comments
 (0)