-
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.
- Loading branch information
Showing
6 changed files
with
77 additions
and
28 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/waruru/areyouhere/attendee/advice/AttendeeExceptionAdvice.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,31 @@ | ||
package com.waruru.areyouhere.attendee.advice; | ||
|
||
import static com.waruru.areyouhere.common.utils.HttpStatusResponseEntity.RESPONSE_NOT_FOUND; | ||
import static com.waruru.areyouhere.common.utils.HttpStatusResponseEntity.RESPONSE_NO_CONTENT; | ||
|
||
import com.waruru.areyouhere.attendee.exception.ClassAttendeesEmptyException; | ||
import com.waruru.areyouhere.attendee.exception.SessionAttendeesEmptyException; | ||
import com.waruru.areyouhere.session.exception.CourseIdNotFoundException; | ||
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("com.waruru.areyouhere.attendee") | ||
public class AttendeeExceptionAdvice { | ||
@ExceptionHandler(CourseIdNotFoundException.class) | ||
public ResponseEntity<HttpStatus> courseIdNotFoundFoundHandler() { | ||
return RESPONSE_NOT_FOUND; | ||
} | ||
|
||
@ExceptionHandler(SessionAttendeesEmptyException.class) | ||
public ResponseEntity<HttpStatus> sessionAttendeesEmptyHandler() { | ||
return RESPONSE_NO_CONTENT; | ||
} | ||
|
||
@ExceptionHandler(ClassAttendeesEmptyException.class) | ||
public ResponseEntity<HttpStatus> classAttendeesEmptyHandler() { | ||
return RESPONSE_NO_CONTENT; | ||
} | ||
|
||
} |
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/waruru/areyouhere/attendee/exception/ClassAttendeesEmptyException.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,14 @@ | ||
package com.waruru.areyouhere.attendee.exception; | ||
|
||
public class ClassAttendeesEmptyException extends RuntimeException{ | ||
public ClassAttendeesEmptyException() { | ||
} | ||
|
||
public ClassAttendeesEmptyException(String message) { | ||
super(message); | ||
} | ||
|
||
public ClassAttendeesEmptyException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/waruru/areyouhere/attendee/exception/SessionAttendeesEmptyException.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,14 @@ | ||
package com.waruru.areyouhere.attendee.exception; | ||
|
||
public class SessionAttendeesEmptyException extends RuntimeException{ | ||
public SessionAttendeesEmptyException() { | ||
} | ||
|
||
public SessionAttendeesEmptyException(String message) { | ||
super(message); | ||
} | ||
|
||
public SessionAttendeesEmptyException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
} |
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
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