rack-insight 0.5.22 → 0.5.23
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +22 -0
- data/lib/rack/insight/database.rb +1 -1
- data/lib/rack/insight/panel.rb +14 -24
- data/lib/rack/insight/render.rb +1 -1
- data/lib/rack/insight/version.rb +1 -1
- data/lib/rack/insight/views/headers_fragment.html.erb +1 -1
- data/lib/rack/insight/views/request_fragment.html.erb +2 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
== HEAD
|
2
2
|
|
3
|
+
== 0.5.23 / 2012-09-14
|
4
|
+
|
5
|
+
* New Features
|
6
|
+
|
7
|
+
* No longer rescue Object, and instead rescue Standard Error.
|
8
|
+
If this is a problem strange non-StandardErrors should be wrapped. (pboling - Peter Boling)
|
9
|
+
|
10
|
+
* Refactor Panel error handling. (pboling - Peter Boling)
|
11
|
+
|
12
|
+
Create error handling method: `handle_error_for(method_name, exception)`
|
13
|
+
Logs the error.
|
14
|
+
Returns HTML for the view.
|
15
|
+
Simplifies error handling in any panel that overrides one of:
|
16
|
+
content, heading, content_for_request and heading_for_request
|
17
|
+
like this:
|
18
|
+
|
19
|
+
def content
|
20
|
+
# Do stuff
|
21
|
+
rescue StandardError => ex
|
22
|
+
handle_error_for(method_name, ex)
|
23
|
+
end
|
24
|
+
|
3
25
|
== 0.5.22 / 2012-09-14
|
4
26
|
|
5
27
|
* New Features
|
@@ -75,7 +75,7 @@ module Rack::Insight
|
|
75
75
|
@db = SQLite3::Database.new(database_path)
|
76
76
|
@db.execute("pragma foreign_keys = on")
|
77
77
|
@db
|
78
|
-
rescue
|
78
|
+
rescue StandardError => ex
|
79
79
|
msg = "Issue while loading SQLite DB:" + [ex.class, ex.message, ex.backtrace[0..4]].inspect
|
80
80
|
logger.error{ msg }
|
81
81
|
|
data/lib/rack/insight/panel.rb
CHANGED
@@ -244,13 +244,8 @@ module Rack::Insight
|
|
244
244
|
heading
|
245
245
|
end
|
246
246
|
end
|
247
|
-
rescue
|
248
|
-
|
249
|
-
msg = ["Failed to create heading_for_request for #{nom}","#{ex.class}: #{ex.message}"] + ex.backtrace
|
250
|
-
logger.error(msg.join("\n"))
|
251
|
-
"Err3: #{nom}
|
252
|
-
<!-- Panel: #{self.inspect}\n
|
253
|
-
#{msg.join("\n")} -->"
|
247
|
+
rescue StandardError => exception
|
248
|
+
handle_error_for('heading_for_request', exception)
|
254
249
|
end
|
255
250
|
|
256
251
|
def content_for_request(number)
|
@@ -270,34 +265,29 @@ module Rack::Insight
|
|
270
265
|
else
|
271
266
|
content
|
272
267
|
end
|
273
|
-
rescue
|
274
|
-
|
275
|
-
msg = ["Failed to create content_for_request for #{nom}","#{ex.class}: #{ex.message}"] + ex.backtrace
|
276
|
-
logger.error(msg.join("\n"))
|
277
|
-
"Err4: #{nom}
|
278
|
-
<!-- Panel: #{self.inspect}\n
|
279
|
-
#{msg.join("\n")} -->"
|
268
|
+
rescue StandardError => exception
|
269
|
+
handle_error_for('content_for_request', exception)
|
280
270
|
end
|
281
271
|
|
282
272
|
def heading
|
283
273
|
self.camelized_name
|
284
|
-
rescue
|
285
|
-
|
286
|
-
msg = ["Failed to create heading for #{nom}","#{ex.class}: #{ex.message}"] + ex.backtrace
|
287
|
-
logger.error(msg.join("\n"))
|
288
|
-
"Err1: #{nom}
|
289
|
-
<!-- Panel: #{self.inspect}\n
|
290
|
-
#{msg.join("\n")} -->"
|
274
|
+
rescue StandardError => exception
|
275
|
+
handle_error_for('heading', exception)
|
291
276
|
end
|
292
277
|
|
293
278
|
def content
|
294
279
|
logger.info("Rack::Insight is using default content for #{self.class}") if verbose(:med)
|
295
280
|
render_template 'no_content', :name => self.camelized_name
|
296
|
-
rescue
|
281
|
+
rescue StandardError => exception
|
282
|
+
handle_error_for('content', exception)
|
283
|
+
end
|
284
|
+
|
285
|
+
def handle_error_for(method_name, exception)
|
297
286
|
nom = self.name rescue "xxx"
|
298
|
-
msg = ["
|
287
|
+
msg = ["#{self.class}##{method_name} failed","#{exception.class}: #{exception.message}"] + exception.backtrace
|
299
288
|
logger.error(msg.join("\n"))
|
300
|
-
|
289
|
+
# return HTML
|
290
|
+
"Error in #{nom}
|
301
291
|
<!-- Panel: #{self.inspect}\n
|
302
292
|
#{msg.join("\n")} -->"
|
303
293
|
end
|
data/lib/rack/insight/render.rb
CHANGED
data/lib/rack/insight/version.rb
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
<%= panel.heading_for_request(request_id) %>
|
13
13
|
</a>
|
14
14
|
<% end %>
|
15
|
-
<% rescue
|
15
|
+
<% rescue StandardError => ex %>
|
16
16
|
Err5: <%= panel.name rescue "xxx" %>
|
17
17
|
<!-- Panel: <%= panel.inspect %> -->
|
18
18
|
<!-- <%= ([ex.class.name, ex.message] + ex.backtrace).join("\n") %> -->
|
@@ -16,8 +16,8 @@
|
|
16
16
|
</div>
|
17
17
|
<% begin %>
|
18
18
|
<%= panel.content_for_request(request_id) %>
|
19
|
-
<% rescue
|
20
|
-
<%= "Error #{ex.class.name}: #{ex.message} <!-- #{ex.backtrace
|
19
|
+
<% rescue StandardError => ex %>
|
20
|
+
<%= "Error #{ex.class.name}: #{ex.message} <!-- #{ex.backtrace.join("\n")} -->" %>
|
21
21
|
<% end %>
|
22
22
|
</div>
|
23
23
|
<% end %>
|