| | 5 | # CSS shared among error templates |
|---|
| | 6 | CSS = """ |
|---|
| | 7 | body { margin: 0px; padding: 0px; font-family: sans-serif; } |
|---|
| | 8 | h1 { background: #3E2B09; padding: 45px 10px 10px 10px; color: #6F5E3C; border: 0px; border-bottom: 2px solid #1C0907; margin: 0px; } |
|---|
| | 9 | h1 span.error { text-shadow: 0.1em 0.1em #333; color: white; } |
|---|
| | 10 | h2 { margin: 0px; padding: 5px 5px 10px 10px; font-size: 14pt !important; } |
|---|
| | 11 | h2 span.where { color: #999; } |
|---|
| | 12 | h3 { margin: 0px; padding: 10px 10px; color: #999;} |
|---|
| | 13 | ul { margin: 0px; } |
|---|
| | 14 | li { margin: 0px; padding: 0px 30px; } |
|---|
| | 15 | pre { padding: 0 30px; margin: 0px; } |
|---|
| | 16 | """ |
|---|
| | 17 | |
|---|
| | 20 | error_page("500 Internal Server Error", error.class.to_s, "500 Internal Server Error", error.message.to_s, "at #{error.backtrace[0]}", "<h3>Backtrace</h3>\n\t<pre>#{error.backtrace.join('\n')}</pre>") |
|---|
| | 21 | end |
|---|
| | 22 | |
|---|
| | 23 | # Standard template to render for a <tt>404 Page Not Found</tt> error |
|---|
| | 24 | def self.not_found(url, remote_ip, params) |
|---|
| | 25 | error_page("404 Not Found", "Page Not Found", "404 Not Found", "Request for #{url}", "from #{remote_ip}") |
|---|
| | 26 | end |
|---|
| | 27 | |
|---|
| | 28 | private |
|---|
| | 29 | # Standard template to render for a <tt>404 Page Not Found</tt> error |
|---|
| | 30 | def self.error_page(title, h1_primary, h1_secondary, h2_primary, h2_secondary, extra_content = "") |
|---|
| 12 | | body { margin: 0px; padding: 0px; font-family: sans-serif; } |
|---|
| 13 | | h1 { background: #3E2B09; padding: 45px 10px 10px 10px; color: #6F5E3C; border: 0px; border-bottom: 2px solid #1C0907; margin: 0px; } |
|---|
| 14 | | h1 span.error { text-shadow: 0.1em 0.1em #333; color: white; } |
|---|
| 15 | | h2 { margin: 0px; padding: 5px 5px 10px 10px; font-size: 14pt !important; } |
|---|
| 16 | | h2 span.where { color: #999; } |
|---|
| 17 | | h3 { margin: 0px; padding: 10px 10px; color: #999;} |
|---|
| 18 | | ul { margin: 0px; } |
|---|
| 19 | | li { margin: 0px; padding: 0px 30px; } |
|---|
| 20 | | pre { padding: 0 30px; margin: 0px; } |
|---|
| | 36 | #{CSS} |
|---|
| 38 | | |
|---|
| 39 | | """ |
|---|
| 40 | | end |
|---|
| 41 | | |
|---|
| 42 | | # Standard template to render for a <tt>404 Page Not Found</tt> error |
|---|
| 43 | | def self.not_found(url, remote_ip, params) |
|---|
| 44 | | """ |
|---|
| 45 | | <html> |
|---|
| 46 | | <head> |
|---|
| 47 | | <title>Vintage Error: 404 Page Not Found</title> |
|---|
| 48 | | <style> |
|---|
| 49 | | body { margin: 0px; padding: 0px; font-family: sans-serif; } |
|---|
| 50 | | h1 { background: #3E2B09; padding: 45px 10px 10px 10px; color: #6F5E3C; border: 0px; border-bottom: 2px solid #1C0907; margin: 0px; } |
|---|
| 51 | | h1 span.error { text-shadow: 0.1em 0.1em #333; color: white; } |
|---|
| 52 | | h2 { margin: 0px; padding: 5px 5px 10px 10px; font-size: 14pt !important; } |
|---|
| 53 | | h2 span.where { color: #999; } |
|---|
| 54 | | h3 { margin: 0px; padding: 10px 10px; color: #999;} |
|---|
| 55 | | ul { margin: 0px; } |
|---|
| 56 | | li { margin: 0px; padding: 0px 30px; } |
|---|
| 57 | | pre { padding: 0 30px; margin: 0px; } |
|---|
| 58 | | </style> |
|---|
| 59 | | </head> |
|---|
| 60 | | |
|---|
| 61 | | <body> |
|---|
| 62 | | <h1><span class='error'>Page Not Found</span> 404 Not Found</h1> |
|---|
| 63 | | <h2>Request for #{url} <span class='where'>from #{remote_ip}</span></h2> |
|---|
| 64 | | <div> |
|---|
| 65 | | <h3>Parameters</h3> |
|---|
| 66 | | <ul> |
|---|
| 67 | | #{params == {} ? "None" : params.to_a.map{|key, val| "<li><b>" + key.to_s + "<b> = " + val.to_s + "</li>"}.join("\n") } |
|---|
| 68 | | </ul> |
|---|
| 69 | | </div> |
|---|
| 70 | | </body> |
|---|
| 71 | | </html> |
|---|
| 72 | | |
|---|