Class: Wee::ErrorResponse
Constant Summary
Constants inherited from Response
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize(exception) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #render(c) ⇒ Object
Methods inherited from Response
#<<, #content_type, #content_type=, #cookies, #cookies?
Constructor Details
#initialize(exception) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
73 74 75 76 77 |
# File 'lib/wee/response.rb', line 73 def initialize(exception) super('text/html', '') @exception = exception render(@content) end |
Instance Method Details
#render(c) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/wee/response.rb', line 79 def render(c) c << "<html><head><title>Error occured</title></head><body>" c << "<p>#{ CGI.escapeHTML(@exception.inspect) }<br/>" c << @exception.backtrace.map{|s| CGI.escapeHTML(s)}.join("<br/>") c << "</p>" c << "</body></html>" end |