Method: RDoc::Servlet#error

Defined in:
lib/rdoc/servlet.rb

#error(exception, req, res) ⇒ Object

Generates an error page for the exception while handling req on res.



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/rdoc/servlet.rb', line 203

def error exception, req, res
  backtrace = exception.backtrace.join "\n"

  res.content_type = 'text/html'
  res.status = 500
  res.body = "<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">\n\n<title>Error - \#{ERB::Util.html_escape exception.class}</title>\n\n<link type=\"text/css\" media=\"screen\" href=\"\#{@mount_path}/css/rdoc.css\" rel=\"stylesheet\">\n</head>\n<body>\n<h1>Error</h1>\n\n<p>While processing <code>\#{ERB::Util.html_escape req.request_uri}</code> the\nRDoc (\#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a\n<code>\#{ERB::Util.html_escape exception.class}</code>\nexception:\n\n<pre>\#{ERB::Util.html_escape exception.message}</pre>\n\n<p>Please report this to the\n<a href=\"https://github.com/ruby/rdoc/issues\">RDoc issues tracker</a>.  Please\ninclude the RDoc version, the URI above and exception class, message and\nbacktrace.  If you're viewing a gem's documentation, include the gem name and\nversion.  If you're viewing Ruby's documentation, include the version of ruby.\n\n<p>Backtrace:\n\n<pre>\#{ERB::Util.html_escape backtrace}</pre>\n\n</body>\n</html>\n  BODY\nend\n"