File tree 1 file changed +6
-1
lines changed
src/main/kotlin/org/gitanimals/core/advice
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
8
8
import org.springframework.web.bind.annotation.ExceptionHandler
9
9
import org.springframework.web.bind.annotation.ResponseStatus
10
10
import org.springframework.web.bind.annotation.RestControllerAdvice
11
- import java.lang.Exception
11
+ import org.springframework.web.servlet.resource.NoResourceFoundException
12
12
13
13
@RestControllerAdvice
14
14
class GlobalExceptionHandler {
@@ -45,4 +45,9 @@ class GlobalExceptionHandler {
45
45
logger.error(exception.message, exception)
46
46
return ErrorResponse (" UN HANDLED EXCEPTION" )
47
47
}
48
+
49
+ @ExceptionHandler(NoResourceFoundException ::class )
50
+ @ResponseStatus(HttpStatus .NOT_FOUND )
51
+ fun handleNoResourceFoundException (noResourceFoundException : NoResourceFoundException ): ErrorResponse =
52
+ ErrorResponse (" NOT FOUND" )
48
53
}
You can’t perform that action at this time.
0 commit comments