diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-01-28 13:47:30 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-01-28 13:47:30 +0100 |
commit | f6974add6878b95b592865c3ad640bdc48cc78ec (patch) | |
tree | 7c1de88ea7eca1f7d72b43b54367674e9f949273 /error.cgi | |
parent | 90a6b261d9c7f1d6dd1a7007a213d4426436b99a (diff) |
Page included for error reporting
Diffstat (limited to 'error.cgi')
-rwxr-xr-x | error.cgi | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/error.cgi b/error.cgi new file mode 100755 index 0000000..c74e80b --- /dev/null +++ b/error.cgi @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby + +############################################################################ +# Copyright 2009,2010 Benjamin Kellermann # +# # +# This file is part of dudle. # +# # +# Dudle is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Affero General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# Dudle is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public # +# License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with dudle. If not, see <http://www.gnu.org/licenses/>. # +############################################################################ + +require "dudle" + +$d = Dudle.new + +def urlescape(str) + CGI.escapeHTML(CGI.escape(str).gsub("+","%20")) +end + +errormessagebody = <<MESSAGE +Hi! + +I found a bug in your application at #{SITEURL}. +I did the following: + +<please describe what you did> +<e.g., I wanted to sent a comment to the poll.> + +I am using <please state your browser and operating system> +MESSAGE + +if defined?(ERRORLOG) + begin + a = File.open(ERRORLOG,"r").to_a + rescue Exception => e + errorstr = "Exception while opening #{ERRORLOG}:\n#{e}" + else + s = [a.pop] + s << a.pop while s.last.scan(/^\[([^\]]*)\] \[/).flatten[0] == a.last.scan(/^\[([^\]]*)\] \[/).flatten[0] + errorstr = s.reverse.join + end + + errormessagebody += <<MESSAGE + +The following error was printed: +#{errorstr} +MESSAGE + +end +errormessagebody += <<MESSAGE + +Yours, + +MESSAGE + + $d << <<ERROR +An error occured while executing dudle.<br/> +Please report you browser, operating system, and what you did to +<a href='mailto:#{BUGREPORTMAIL}?subject=#{urlescape("Bug in dudle")}&body=#{urlescape(errormessagebody)}'>#{BUGREPORTMAIL}</a>. +ERROR + +if (errorstr) + + $d << <<ERROR +<br/> +Please include the following as well: +<pre style='background:#DDD;padding : 1em'>#{errorstr}</pre> +ERROR +end + +$d.out |