Class: Cyberweb::CGI::ModRubyExceptionPrinter

Inherits:
Exception
  • Object
show all
Defined in:
lib/cyberweb/cgi/mod_ruby_exception_printer.rb

Constant Summary

Constants inherited from Exception

Exception::CONTENT_TYPE, Exception::TOP_DIV_ELEMENT

Instance Attribute Summary

Attributes inherited from Exception

#out

Instance Method Summary collapse

Methods inherited from Exception

#escape_html, #handle, #initialize, #skip_header, #skip_header=, #skip_header?

Constructor Details

This class inherits a constructor from Cyberweb::CGI::Exception

Instance Method Details

#

print_exception

This method is responsible for printing the exception.

#


32
33
34
35
36
37
38
# File 'lib/cyberweb/cgi/mod_ruby_exception_printer.rb', line 32

def print_exception(
    the_exception
  )
  super
  result = "#{the_exception.backtrace.first}: #{the_exception.message} (#{the_exception.class.name})\n"
  $stderr.write(result)
end
#

print_header

print HTTP header (for mod_ruby)

#


18
19
20
21
22
23
24
25
# File 'lib/cyberweb/cgi/mod_ruby_exception_printer.rb', line 18

def print_header
  request = Apache::request # Request for when we use Apache.
  request.status       = 500
  request.status_line  = '500 Internal Error'
  request.content_type = 'text/html'
  request.headers_out['X-CGI-Exception'] = '0.3.0'
  request.send_http_header
end