Exception: Sidewalk::HttpError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Sidewalk::HttpError
- Defined in:
- lib/sidewalk/errors.rb
Overview
Base class for HTTP errors.
This is raised by controllers.
Direct Known Subclasses
Instance Method Summary collapse
-
#description(request) ⇒ String
The description to return in response to the request.
-
#initialize(status, description) ⇒ HttpError
constructor
Initialize an Error exception.
-
#status(request) ⇒ Fixnum
The status code to return in response to the request.
Constructor Details
#initialize(status, description) ⇒ HttpError
Initialize an Error exception.
If the parameters are nil
, you will need to override #status and #description for this class to work as expected.
14 15 16 |
# File 'lib/sidewalk/errors.rb', line 14 def initialize status, description @status, @description = status, description end |
Instance Method Details
#description(request) ⇒ String
The description to return in response to the request.
It takes a request to allow different responses to be given to, for example, HTTP/1.0 clients vs HTTP/1.1 clients.
38 39 40 |
# File 'lib/sidewalk/errors.rb', line 38 def description request @description end |
#status(request) ⇒ Fixnum
The status code to return in response to the request.
It takes a request to allow different responses to be given to, for example, HTTP/1.0 clients vs HTTP/1.1 clients.
26 27 28 |
# File 'lib/sidewalk/errors.rb', line 26 def status request @status end |