File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/kotlin/org/gitanimals/core/advice Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import org.springframework.web.bind.MissingRequestHeaderException
88import org.springframework.web.bind.annotation.ExceptionHandler
99import org.springframework.web.bind.annotation.ResponseStatus
1010import org.springframework.web.bind.annotation.RestControllerAdvice
11- import java.lang.Exception
11+ import org.springframework.web.servlet.resource.NoResourceFoundException
1212
1313@RestControllerAdvice
1414class GlobalExceptionHandler {
@@ -45,4 +45,9 @@ class GlobalExceptionHandler {
4545 logger.error(exception.message, exception)
4646 return ErrorResponse (" UN HANDLED EXCEPTION" )
4747 }
48+
49+ @ExceptionHandler(NoResourceFoundException ::class )
50+ @ResponseStatus(HttpStatus .NOT_FOUND )
51+ fun handleNoResourceFoundException (noResourceFoundException : NoResourceFoundException ): ErrorResponse =
52+ ErrorResponse (" NOT FOUND" )
4853}
You can’t perform that action at this time.
0 commit comments