class Athena::Framework::Exceptions::HTTPException
inherits Exception
#
Represents an HTTP error.
Each child represents a specific HTTP error with the associated status code. Also optionally allows adding headers to the resulting response.
Can be used directly/inherited from to represent non-typical HTTP errors/codes.
Direct known subclasses
Athena::Framework::Exceptions::BadGateway
Athena::Framework::Exceptions::BadRequest
Athena::Framework::Exceptions::Conflict
Athena::Framework::Exceptions::Forbidden
Athena::Framework::Exceptions::Gone
Athena::Framework::Exceptions::LengthRequired
Athena::Framework::Exceptions::MethodNotAllowed
Athena::Framework::Exceptions::NotAcceptable
Athena::Framework::Exceptions::NotFound
Athena::Framework::Exceptions::NotImplemented
Athena::Framework::Exceptions::PreconditionFailed
Athena::Framework::Exceptions::ServiceUnavailable
Athena::Framework::Exceptions::TooManyRequests
Athena::Framework::Exceptions::Unauthorized
Athena::Framework::Exceptions::UnprocessableEntity
Athena::Framework::Exceptions::UnsupportedMediaType
Constructors#
.new(status : HTTP::Status, message : String, cause : Exception | Nil = nil, headers : HTTP::Headers = HTTP::Headers.new)
#
Instantiates self
with the given status and message.
Optionally includes cause, and headers.
.new(status_code : Int32, message : String, cause : Exception | Nil = nil, headers : HTTP::Headers = HTTP::Headers.new)
#
Instantiates self
with the given status_code and message.
Optionally includes cause, and headers.
Methods#
#headers : HTTP::Headers
#
Any HTTP response headers associated with self
.
Some HTTP errors use response headers to give additional information about self
.
#headers=(headers : HTTP::Headers)
#
Any HTTP response headers associated with self
.
Some HTTP errors use response headers to give additional information about self
.
#to_json(builder : JSON::Builder) : Nil
#
Serializes self
to JSON in the format of {"code":400,"message":"Exception message"}