-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
234 additions
and
17 deletions.
There are no files selected for viewing
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
12 changes: 12 additions & 0 deletions
12
.../com/example/pnuunivmiryangcampus/librarySeat/exception/LibrarySeatNotFoundException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.librarySeat.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.NotFoundException; | ||
|
||
public class LibrarySeatNotFoundException extends NotFoundException { | ||
|
||
private static final String MESSAGE = "해당 좌석은 존재하지 않습니다."; | ||
|
||
public LibrarySeatNotFoundException() { | ||
super(MESSAGE); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...com/example/pnuunivmiryangcampus/reservation/exception/DuplicateReservationException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.reservation.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.BadRequestException; | ||
|
||
public class DuplicateReservationException extends BadRequestException { | ||
|
||
private static final String MESSAGE = "이미 예약된 좌석이 존재합니다."; | ||
|
||
public DuplicateReservationException() { | ||
super(MESSAGE); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...a/com/example/pnuunivmiryangcampus/reservation/exception/ExpiredRenewalTimeException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.reservation.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.BadRequestException; | ||
|
||
public class ExpiredRenewalTimeException extends BadRequestException { | ||
|
||
private static final String MESSAGE = "연장 가능 시간은 종료 시간의 30분 전입니다."; | ||
|
||
public ExpiredRenewalTimeException() { | ||
super(MESSAGE); | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...example/pnuunivmiryangcampus/reservation/exception/ReservationLimitExceededException.java
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
12 changes: 12 additions & 0 deletions
12
.../com/example/pnuunivmiryangcampus/reservation/exception/ReservationNotFoundException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.reservation.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.NotFoundException; | ||
|
||
public class ReservationNotFoundException extends NotFoundException { | ||
|
||
private static final String MESSAGE = "예약된 좌석을 찾을 수 없습니다."; | ||
|
||
public ReservationNotFoundException() { | ||
super(MESSAGE); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/BadRequestException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class BadRequestException extends BusinessException { | ||
|
||
public BadRequestException(String message) { | ||
super(message); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/BusinessException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class BusinessException extends RuntimeException { | ||
|
||
public BusinessException(String message) { | ||
super(message); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/example/pnuunivmiryangcampus/support/exception/ControllerAdvice.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice | ||
public class ControllerAdvice { | ||
|
||
@ExceptionHandler(NotFoundException.class) | ||
public ResponseEntity<ErrorResponse> handleNotFoundException(NotFoundException e) { | ||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ErrorResponse(e.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(BadRequestException.class) | ||
public ResponseEntity<ErrorResponse> handleBadRequestException(BadRequestException e) { | ||
return ResponseEntity.badRequest().body(new ErrorResponse(e.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(ForbiddenException.class) | ||
public ResponseEntity<ErrorResponse> handleForbiddenException(ForbiddenException e) { | ||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(new ErrorResponse(e.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(UnauthorizedException.class) | ||
public ResponseEntity<ErrorResponse> handleUnauthorizedException(UnauthorizedException e) { | ||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new ErrorResponse(e.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(RuntimeException.class) | ||
public ResponseEntity<ErrorResponse> handleRuntimeException(RuntimeException e) { | ||
return ResponseEntity.internalServerError().body(new ErrorResponse("서버에 알 수 없는 문제가 발생했습니다.")); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/example/pnuunivmiryangcampus/support/exception/ErrorResponse.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ErrorResponse { | ||
|
||
private final String message; | ||
|
||
public ErrorResponse(String message) { | ||
this.message = message; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/ForbiddenException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class ForbiddenException extends BusinessException { | ||
|
||
public ForbiddenException(String message) { | ||
super(message); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/InternalException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class InternalException extends BusinessException { | ||
|
||
public InternalException(String message) { | ||
super(message); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/NotFoundException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class NotFoundException extends BusinessException { | ||
|
||
public NotFoundException(String message) { | ||
super(message); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/pnuunivmiryangcampus/support/exception/UnauthorizedException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.pnuunivmiryangcampus.support.exception; | ||
|
||
public class UnauthorizedException extends BusinessException { | ||
|
||
public UnauthorizedException(String message) { | ||
super(message); | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/main/java/com/example/pnuunivmiryangcampus/support/token/Exception500.java
This file was deleted.
Oops, something went wrong.
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
12 changes: 12 additions & 0 deletions
12
.../java/com/example/pnuunivmiryangcampus/support/token/exception/ExpiredTokenException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.support.token.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.UnauthorizedException; | ||
|
||
public class ExpiredTokenException extends UnauthorizedException { | ||
|
||
private static final String MESSAGE = "Token의 유효기간이 만료되었습니다."; | ||
|
||
public ExpiredTokenException() { | ||
super(MESSAGE); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
.../java/com/example/pnuunivmiryangcampus/support/token/exception/InvalidTokenException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.support.token.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.UnauthorizedException; | ||
|
||
public class InvalidTokenException extends UnauthorizedException { | ||
|
||
private static final String MESSAGE = "유효하지 않는 Token 입니다."; | ||
|
||
public InvalidTokenException() { | ||
super(MESSAGE); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...n/java/com/example/pnuunivmiryangcampus/support/token/exception/JsonParsingException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.pnuunivmiryangcampus.support.token.exception; | ||
|
||
import com.example.pnuunivmiryangcampus.support.exception.InternalException; | ||
|
||
public class JsonParsingException extends InternalException { | ||
|
||
private static final String MESSAGE = "JSON Parsing 과정에서 오류가 발생했습니다."; | ||
|
||
public JsonParsingException(String message) { | ||
super(MESSAGE + ": " + message); | ||
} | ||
} |