what_does_this_error_mean-merb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 GiraffeSoft Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,10 @@
1
+ WhatDoesThisErrorMean
2
+ =====================
3
+
4
+ This plugin overrides the error message page that appears in merg development mode when an exception is raised to provide a link to search whatdoesthiserrormean.com for that error.
5
+
6
+ = Installation
7
+
8
+ dependency "what_does_this_error_mean-merb", "ver_no"
9
+
10
+ Copyright (c) 2008 GiraffeSoft Inc., released under the MIT license
@@ -0,0 +1,16 @@
1
+ require 'merb-core'
2
+
3
+ Merb::Dispatcher::DefaultException._template_root = File.dirname(__FILE__) / ".." / "templates"
4
+
5
+ module WhatDoesThisErrorMeanMerb
6
+ NAME = 'what_does_this_error_mean-merb'
7
+
8
+ module VERSION
9
+ MAJOR = 0
10
+ MINOR = 0
11
+ TINY = 1
12
+
13
+ STRING = [MAJOR, MINOR, TINY].join('.')
14
+ end
15
+ end
16
+
@@ -0,0 +1,200 @@
1
+ <% if Merb.env != "test" %>
2
+ <style type="text/css" media="screen">
3
+ body {
4
+ font-family:arial;
5
+ font-size:11px;
6
+ }
7
+ p.options {
8
+ text-align: right;
9
+ }
10
+ p.options label {
11
+ margin-left: 10px;
12
+ }
13
+ p.options span.all {
14
+ padding: 5px;
15
+ border: 1px solid #000;
16
+ background-color: #fff;
17
+ }
18
+ p.options input {
19
+ position: relative;
20
+ }
21
+ h1 {
22
+ font-size:48px;
23
+ letter-spacing:-4px;
24
+ margin:0 0 20px 0;
25
+ line-height:36px;
26
+ color:#333;
27
+ }
28
+ h1 sup {
29
+ font-size: 0.5em;
30
+ }
31
+ h1 sup.error_500, h1 sup.error_400 {
32
+ color:#990E05;
33
+ }
34
+ h1 sup.error_100, h1 sup.error_200 {
35
+ color:#00BF10;
36
+ }
37
+ h1 sup.error_300 {
38
+ /* pretty sure you cant 'see' status 300
39
+ errors but if you could I think they
40
+ would be blue */
41
+ color:#1B2099;
42
+ }
43
+ h2 {
44
+ font-size:24px;
45
+ letter-spacing:-1px;
46
+ margin:0;
47
+ line-height:28px;
48
+ color:#444;
49
+ }
50
+ h3 {
51
+ cursor: pointer;
52
+ color: #006;
53
+ text-decoration: underline;
54
+ }
55
+ a, a:visited {
56
+ color:#00BF10;
57
+ }
58
+ .internalError {
59
+ width:800px;
60
+ margin:50px auto;
61
+ }
62
+ .header {
63
+ border-bottom:10px solid #333;
64
+ margin-bottom:1px;
65
+ background-image: url("data:image/gif;base64,R0lGODlhAwADAIAAAP///8zMzCH5BAAAAAAALAAAAAADAAMAAAIEBHIJBQA7");
66
+ padding:20px;
67
+ }
68
+ .header ul {
69
+ padding: 5px;
70
+ background-color: white;
71
+ }
72
+ .header ul li {
73
+ list-style-type: none;
74
+ font-size: 16px;
75
+ margin-bottom: 6px;
76
+ }
77
+
78
+ table.listing {
79
+ border-collapse: collapse;
80
+ font-size: 12px;
81
+ width: 100%;
82
+ }
83
+
84
+ table.listing th {
85
+ background-color: #000;
86
+ color: #fff;
87
+ }
88
+
89
+ table.listing td, table.listing th {
90
+ padding: 5px;
91
+ text-align: left;
92
+ vertical-align: top;
93
+ }
94
+
95
+ table.listing tr.odd {
96
+ background-color: #ccc;
97
+ }
98
+
99
+ table.listing tr.even {
100
+ background-color: #aaa;
101
+ }
102
+
103
+ table.listing td[colspan=2] {
104
+ text-align: center;
105
+ }
106
+
107
+ table.trace {
108
+ width:100%;
109
+ font-family:courier, monospace;
110
+ letter-spacing:-1px;
111
+ border-collapse: collapse;
112
+ border-spacing:0;
113
+ }
114
+ table.trace tr td{
115
+ padding:0;
116
+ height:26px;
117
+ font-size:13px;
118
+ vertical-align:middle;
119
+ }
120
+ table.trace tr.file{
121
+ border-top:2px solid #fff;
122
+ background-color:#F3F3F3;
123
+ }
124
+ table.trace tr.source {
125
+ background-color:#F8F8F8;
126
+ display:none;
127
+ }
128
+ table.trace .open tr.source {
129
+ display:table-row;
130
+ }
131
+ table.trace tr.file td.expand {
132
+ width:23px;
133
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdVJREFUeNqMVL+TwUAYxaRIOlEhlZHGDAUzzOQ61+AqXMV1lJSU7q/QRqm8KFUcJTNn5qJkaPyoKKVz7y4mF8na5Kt29tt9+/Z97/u81+vVQ4r9frdarS6Xi7ETDIZisRjxMGPfmk4niNPpZE+xLAugbPaZ53nzvtfMBe/3+/3dbuehBrAKhZdUKkVAWa9Xsiybv0CPZDJZLr/qa5/BwgwRjYqOKIvFYjQa/aNommZh0Ww2K5UqzwfoQOPxaLPZ3FAmk0+7lplMpt1u53J5OpBOR0eZEE9wHJfP5zud93g88QhluwWbjW+5VOmKBgKBer3eaDTDYeGBQF8+x7rqIYoiPgixWJazpA6HA+MSxRArkUgMh0M409g8Ho8+9wYxxCqVSq1W26EDHGM2m4HOHQrEc38f/Yn7cLmlIRhBENzcx8cVRZnPZ/YUep2BWkjTIfA+PKVpZAXR5QxsjiqCKvGEqqp443w+0dvy17swqD0HB3S73V5PpkNg1qBqt8kwGCjmPkinM0QJbIoEa7U6UG6ToVgs4V9G2g0ESoP5Aoi7KYX5oCgf8IKbkvn9/mr1LRQKESamzgJy0g0tSZIuB3nuGqRU9Vv9C4sKkUhEkp4soxvxI8AAhWrrtXa3X8EAAAAASUVORK5CYII=);
134
+ background-position:top left;
135
+ background-repeat:no-repeat;
136
+ }
137
+ table.trace tr.file td.expand div {
138
+ width:23px;
139
+ }
140
+ table.trace .open tr.file td.expand {
141
+ width:23px;
142
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXZJREFUeNrslK1ywkAUhcMOBomEOiSdqLxEBJX0NaijOsjyHGGmCGyQQYaiiiw4gktkcOmZbpsuuzQ/M5XnqJ2d3S/n3nM3rTzPLUP7/Tt0+pLcGQwG3W53OLyHzPMtjYL7q9UqSRLrD4E1Gj1orCvKYuFHUWTVkOM44/HjDcp8/lL4r6NerzeZPMm1KFw0QkDn83m5fP2lHA4fNQvRtNvtjsfDd0WzmSfb2e/fdTqdOvdh/HLJZLOn0+d2HJ+KRGzbdl23EpFlmed5cp2maRzHQq1lvQ5KMi6EUZBGfup6E1pTfd+vrGW7jbQ2C9hTt9BpqNyIWaAwAy6xg2eBz5iRC/NomiZhGN5sqmnkauo0BUGgVQoBjQ80oCACgNQdZHfTYBkF2mxCtWWAqunWpahxIDUt3QYUxIFQpJHyIWpXjinabKbbwItMHT+NyjchrP8QKaSQQgoppJBCCimkkEIKKaSQQgoppJBCCimkkEIKKaSo+hRgAEFD17X08O2NAAAAAElFTkSuQmCC);
143
+ background-position:top left;
144
+ background-repeat:no-repeat;
145
+ }
146
+ table.trace .open tr.file td.expand div {
147
+ width:23px;
148
+ }
149
+ table.trace tr.source td.collapse {
150
+ width:23px;
151
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAB1CAIAAAAqdO2mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs0zFygkAUBmBlUkgJHdABlQwVkVJKKUxBYWbkALTxMJwhltyDFkss03IF8pudIcwaDaDl/6pd2P327b7d+eHwMXs4lNkzggoVKlSoUKFChQoVKlSoUKFChQoVKlSoUKFChQqVEYqm6ft9+qiSJEkYho7jTlcw2fd9NOI4nq4gEdFwXXe1Cqco63VkWVbXRTqLhTpOwQRpF7quR1E0TgGhqvLKUFCyoQqG/rks3O6kZKW/eRFpevOCoGTXVTcMQ5EyxyDEkML1c5RzuZOICIyXqn7JBVez6282MWrx731HOv2qB8Hri2lamNk0DfpVVdV1Peodappmmua8bdvzuc7zfNprzrLMth1FnGh/X8MjCAIQv/cFz/+65PcDh7rbvYv2ZUfdj+PxsyzLgVl0hKwgTqeqKApx2LeOc7t98zyv/1FWOgvx9RPii23bmL9cetJ8Ed8CDAC6aFW8bCzFhwAAAABJRU5ErkJggg==);
152
+ background-position:bottom left;
153
+ background-repeat:no-repeat;
154
+ background-color:#6F706F;
155
+ }
156
+ table.trace tr td.path {
157
+ padding-left:10px;
158
+ }
159
+ table.trace tbody.app td.path {
160
+ color: #900;
161
+ }
162
+ table.trace tbody.framework td.path {
163
+ color: #009;
164
+ }
165
+ table.trace tbody.gem td.path {
166
+ color: #090;
167
+ }
168
+ table.trace tr td.code {
169
+ padding: 10px 0 10px 20px;
170
+ white-space: pre;
171
+ }
172
+ table.trace tr td.code div {
173
+ width: 700px;
174
+ overflow-x: auto;
175
+ overflow-y: hidden;
176
+ }
177
+ table.trace tr td.code em {
178
+ font-weight:bold;
179
+ color:#00BF10;
180
+ }
181
+ table.trace tr td.code a {
182
+ width: 20px;
183
+ float: left;
184
+ }
185
+ table.trace tr td.code .more {
186
+ color:#666;
187
+ }
188
+ table.trace tr td.line {
189
+ width:30px;
190
+ text-align:right;
191
+ padding-right:4px;
192
+ }
193
+ .footer {
194
+ margin-top:5px;
195
+ font-size:11px;
196
+ color:#444;
197
+ text-align:right;
198
+ }
199
+ </style>
200
+ <% end %>
@@ -0,0 +1,77 @@
1
+ <% if Merb.env != "test" %>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ (function() {
5
+ els = document.getElementsByTagName('td');
6
+ var forEach = function(arr, fn) {
7
+ for(var i=0; i<arr.length; i++) {
8
+ var res = fn(arr[i]);
9
+ if(res === false) break;
10
+ }
11
+ }
12
+ var toggleClasses = function(node, first, second) {
13
+ var classes = node.className.split(" ");
14
+ var newClasses = [];
15
+ forEach(classes, function(k) {
16
+ if(k == first) newClasses.push(second);
17
+ else if(k == second) newClasses.push(first);
18
+ else newClasses.push(k);
19
+ });
20
+ node.className = newClasses.join(" ");
21
+ }
22
+ forEach(els, function(el) {
23
+ // swap the open & closed classes
24
+ if(hasClass(el, "expand") || hasClass(el, "collapse")) {
25
+ el.onclick = function(e){
26
+ tbody = this.parentNode.parentNode;
27
+ toggleClasses(tbody, "open", "close");
28
+ }
29
+ }
30
+ })
31
+ forEach(document.getElementsByTagName("h3"), function(el) {
32
+ el.onclick = function(e) {
33
+ var tag = this.nextSibling;
34
+ while(tag.nodeType != 1) tag = tag.nextSibling;
35
+ tag.style.display = tag.style.display == "none" ? "" : "none";
36
+ }
37
+ })
38
+ function hasClass(node, matchClass) {
39
+ var classes = node.className.split(" ");
40
+ for(var i=0,className;className=classes[i];i++)
41
+ if(className == matchClass) return true;
42
+ return false;
43
+ }
44
+ var els = document.getElementsByTagName("p");
45
+ forEach(els, function(tag) {
46
+ if(tag.className != "options") return true;
47
+ var checkboxes = tag.getElementsByTagName("input");
48
+ forEach(checkboxes, function(box) {
49
+ if(window.navigator.userAgent.match(/Firefox/)) {
50
+ box.style.top = "3px";
51
+ }
52
+ });
53
+ tag.getElementsByTagName("input")[0].onclick = function(e) {
54
+ forEach(checkboxes, function(box) {
55
+ if(box == e.target) return true;
56
+ box.checked = e.target.checked;
57
+ toggleTraces(box, box);
58
+ })
59
+ };
60
+ var toggleTraces = function(box, target) {
61
+ var tbodies = tag.parentNode.getElementsByTagName("tbody");
62
+ forEach(tbodies, function(tbody) {
63
+ if(hasClass(tbody, target.parentNode.className)) {
64
+ if(target.checked) tbody.style.display = "";
65
+ else tbody.style.display = "none";
66
+ }
67
+ })
68
+ }
69
+ forEach(checkboxes, function(box) {
70
+ if(box == checkboxes[0]) return true;
71
+ box.onchange = function(e) { toggleTraces(box, e.target) }
72
+ })
73
+ })
74
+ })();
75
+ //]]>
76
+ </script>
77
+ <% end %>
@@ -0,0 +1,104 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html>
5
+ <head>
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
7
+ <title><%= humanize_exception(@exceptions.first) %></title>
8
+ <%= partial :css %>
9
+ </head>
10
+ <body>
11
+ <% if @show_details %>
12
+ <% if @exceptions.size > 1 %>
13
+ <div class="internalError">
14
+ <div class="header">
15
+ <h1>Error Stack</h1>
16
+ <ul>
17
+ <% @exceptions.each_with_index do |exception,i| %>
18
+ <li>
19
+ <a href="#exception_<%= i %>"><%= humanize_exception(exception) %></a>
20
+ <%= escape_html(exception.message.split("\n",2).first) %>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ </div>
26
+ <% end %>
27
+
28
+ <div class="internalError">
29
+ <div class="header">
30
+ <h1>Request Details</h1>
31
+ <h3>Parameters</h3>
32
+ <%= listing("Parameter", "Value", request.params) %>
33
+
34
+ <% if request.session? %>
35
+ <h3>Session</h3>
36
+ <%= listing("Key", "Value", request.session) %>
37
+ <% end %>
38
+
39
+ <h3>Cookies</h3>
40
+ <%= listing("Cookie", "Value", request.cookies) %>
41
+
42
+ <h3>Named Routes</h3>
43
+ <%= listing("Name", "Route", Merb::Router.named_routes) %>
44
+ </div>
45
+ </div>
46
+ <% end %>
47
+
48
+ <% @exceptions.each_with_index do |exception,i| %>
49
+ <div class="internalError" id="exception_<%= i %>">
50
+ <div class="header">
51
+ <h1>
52
+ <%= humanize_exception(exception) %>
53
+ <sup class="error_<%= exception.class.status %>"><%= exception.class.status %></sup>
54
+ </h1>
55
+ <%= error_codes(exception) %>
56
+ <p class="options">
57
+ <label class="all">All<input type="checkbox" autocomplete="off" /></label>
58
+ <span class="all">
59
+ <label class="app">App<input type="checkbox" checked="checked" autocomplete="off"/></label>
60
+ <label class="framework">Framework<input type="checkbox" autocomplete="off"/></label>
61
+ <label class="gem">Gem<input type="checkbox" autocomplete="off"/></label>
62
+ <label class="other">Other<input type="checkbox" autocomplete="off"/></label>
63
+ </span>
64
+ </p>
65
+
66
+ <% if @show_details %>
67
+ <table class="trace">
68
+ <% exception.backtrace.each_with_index do |line, index| %>
69
+ <% type, shortname, filename, lineno, location = frame_details(line) %>
70
+ <tbody class="close <%= type %>" <%= "style='display:none'" unless type == "app" %>>
71
+ <tr class="file">
72
+ <td class="expand"><div>&nbsp;</div></td>
73
+ <td class="path">
74
+ <%= shortname %>
75
+ <% if filename && filename.match(/\.erb$/) %>
76
+ (<strong>ERB Template</strong>)
77
+ <% else %>
78
+ in <strong><%= location ? location.match(/in (`.+')$/)[1] : 'main' %></strong>
79
+ <% end %>
80
+ </td>
81
+ <td class="line">
82
+ <%= textmate_url(filename, lineno) %>
83
+ </td>
84
+ </tr>
85
+ <%= render_source(filename, lineno) %>
86
+ </tbody>
87
+ <% end %>
88
+ </table>
89
+ <% end %>
90
+ </div>
91
+ <div class="footer">
92
+ lots of love, from <a href="http://www.merbivore.com">merb</a>
93
+ </div>
94
+ <div class="wdtem">
95
+ <form action="http://whatdoesthiserrormean.com/error/search" method="POST" name="wdtem">
96
+ <input type="hidden" name="q" value="<%= exception.class.name.to_s %> <%= exception.message %>" />
97
+ </form>
98
+ <%= link_to image_tag('http://whatdoesthiserrormean.com/images/logo_for_error_page.gif', :border => 0), "javascript: document.forms.wdtem.submit();" %>
99
+ </div>
100
+ </div>
101
+ <% end %>
102
+ <%= partial :javascript %>
103
+ </body>
104
+ </html>
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: what_does_this_error_mean-merb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Francois Beausoleil
8
+ - Daniel Haran
9
+ - James Golick
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2008-10-18 00:00:00 -04:00
15
+ default_executable:
16
+ dependencies: []
17
+
18
+ description: This plugin overrides the error message page that appears in merg development mode when an exception is raised to provide a link to search whatdoesthiserrormean.com for that error.
19
+ email: james@giraffesoft.ca
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - README
28
+ - MIT-LICENSE
29
+ - lib/what_does_this_error_mean-merb.rb
30
+ - templates/_css.html.erb
31
+ - templates/_javascript.html.erb
32
+ - templates/index.html.erb
33
+ has_rdoc: true
34
+ homepage: http://jamesgolick.com/wdtem
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 1.8.5
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project: what_does_this_error_mean-merb
55
+ rubygems_version: 1.2.0
56
+ signing_key:
57
+ specification_version: 2
58
+ summary: Integrates merb development mode with whatdoesthiserrormean.com
59
+ test_files: []
60
+