new exception
This commit is contained in:
parent
9d45d45d35
commit
83d89f4921
9
src/main/java/com/example/nto/dto/CodeDto.java
Normal file
9
src/main/java/com/example/nto/dto/CodeDto.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.example.nto.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CodeDto {
|
||||
private Long value;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.example.nto.exception;
|
||||
|
||||
public class CodeNotFoundException extends RuntimeException {
|
||||
public CodeNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -9,6 +9,11 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(CodeNotFoundException.class)
|
||||
public ResponseEntity<String> handleEntersNotFoundException(CodeNotFoundException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ExceptionHandler(EntersNotFoundException.class)
|
||||
public ResponseEntity<String> handleEntersNotFoundException(EntersNotFoundException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
||||
@ -73,5 +78,4 @@ public class GlobalExceptionHandler {
|
||||
public ResponseEntity<String> handleAuthorityNotFoundException(AuthorityNotFoundException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user