Class: Derailleur::InternalErrorHandler
- Inherits:
-
RackHandler
- Object
- Handler
- RackHandler
- Derailleur::InternalErrorHandler
- Defined in:
- lib/derailleur/core/handler.rb
Overview
This handler returns the error as text/plain object If the error respond_to http_status, then it will modify the HTTP status code accordingly.
Instance Attribute Summary
Attributes included from Handler::Rack
Attributes inherited from Handler
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(err, env, ctx) ⇒ InternalErrorHandler
constructor
A new instance of InternalErrorHandler.
- #page ⇒ Object
Methods included from Handler::Rack
#initialize_rack, #to_rack_output
Constructor Details
#initialize(err, env, ctx) ⇒ InternalErrorHandler
Returns a new instance of InternalErrorHandler.
108 109 110 111 112 113 114 115 |
# File 'lib/derailleur/core/handler.rb', line 108 def initialize(err, env, ctx) super if err.respond_to? :http_status @status = err.http_status else @status = 500 end end |
Instance Method Details
#headers ⇒ Object
117 118 119 |
# File 'lib/derailleur/core/handler.rb', line 117 def headers {'Content-Type' => 'text/plain'} end |
#page ⇒ Object
121 122 123 124 125 |
# File 'lib/derailleur/core/handler.rb', line 121 def page [err.class.name, err., err.backtrace].join("\n") end |