Add an HttpStatus to response

Report a typo

You need to create your own exception like in the example below. You want all your YourExcepNameException exceptions to generate the same HttpStatus code, for example, NOT_FOUND in the response. How can you do it?

Java
class YourExcepNameException extends RuntimeException {
    // ...
}
Kotlin
class YourExcepNameException : RuntimeException() { 
    // ...
}
Select one option from the list
___

Create a free account to access the full topic