Package io.micronaut.http.exceptions
Class HttpStatusException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.micronaut.http.exceptions.HttpException
-
- io.micronaut.http.exceptions.HttpStatusException
-
- All Implemented Interfaces:
java.io.Serializable
public class HttpStatusException extends HttpException
Exception thrown to return an specific HttpStatus and an error message.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HttpStatusException(HttpStatus status, java.lang.Object body)
HttpStatusException(HttpStatus status, java.lang.String message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<java.lang.Object>
getBody()
HttpStatus
getStatus()
-
-
-
Constructor Detail
-
HttpStatusException
public HttpStatusException(HttpStatus status, java.lang.String message)
- Parameters:
status
- TheHttpStatus
message
- The message
-
HttpStatusException
public HttpStatusException(HttpStatus status, java.lang.Object body)
- Parameters:
status
- TheHttpStatus
body
- The arbitrary object to return
-
-
Method Detail
-
getStatus
public HttpStatus getStatus()
- Returns:
- The
HttpStatus
-
getBody
public java.util.Optional<java.lang.Object> getBody()
- Returns:
- The optional body for the response
-
-