wrangler 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -105,7 +105,18 @@ module Wrangler
|
|
|
105
105
|
# if you do change this, you really should have a good reason for it and
|
|
106
106
|
# really know what you're doing. really.
|
|
107
107
|
:absolute_last_resort_default_error_template =>
|
|
108
|
-
File.join(WRANGLER_ROOT,'rails','app','views','wrangler','500.html')
|
|
108
|
+
File.join(WRANGLER_ROOT,'rails','app','views','wrangler','500.html'),
|
|
109
|
+
|
|
110
|
+
# allows for inserting additional data/comments/status/environment into
|
|
111
|
+
# the notification emails. possibilities include fetching the release number,
|
|
112
|
+
# patch info, current state of different services....
|
|
113
|
+
# pass a proc instance that accepts a single
|
|
114
|
+
# argument, the request object (if any).
|
|
115
|
+
# (e.g. +Proc.new { |request| puts "request is: #{request}" }+, but don't
|
|
116
|
+
# do that, that would be redundant, silly and not secure).
|
|
117
|
+
# NOTE: +request+ can be nil (if background process, for example), so
|
|
118
|
+
# implement accordingly
|
|
119
|
+
:call_for_supplementary_info => nil
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
# give access to config
|
|
@@ -255,7 +266,9 @@ module Wrangler
|
|
|
255
266
|
request = options[:request]
|
|
256
267
|
render_errors = options[:render_errors] || false
|
|
257
268
|
proc_name = options[:proc_name] || config[:app_name]
|
|
258
|
-
error_messages = options[:error_messages]
|
|
269
|
+
error_messages = options[:error_messages] || ['']
|
|
270
|
+
|
|
271
|
+
error_messages = [error_messages] unless error_messages.is_a?(Array)
|
|
259
272
|
|
|
260
273
|
if exception.respond_to?(:backtrace)
|
|
261
274
|
backtrace = exception.backtrace
|
|
@@ -267,18 +280,26 @@ module Wrangler
|
|
|
267
280
|
# that should NOT be logged/emailed (passwords etc.)
|
|
268
281
|
request_data = request_data_from_request(request) unless request.nil?
|
|
269
282
|
|
|
283
|
+
supplementary_info = nil
|
|
284
|
+
|
|
285
|
+
unless config[:call_for_supplementary_info].nil?
|
|
286
|
+
supplementary_info = config[:call_for_supplementary_info].call(request)
|
|
287
|
+
supplementary_info = [supplementary_info] unless supplementary_info.is_a?(Array)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
unless supplementary_info.blank?
|
|
291
|
+
error_messages << "Supplementary info:"
|
|
292
|
+
error_messages += supplementary_info
|
|
293
|
+
end
|
|
294
|
+
|
|
270
295
|
if exception.nil?
|
|
271
296
|
exception_classname = nil
|
|
272
297
|
status_code = nil
|
|
273
|
-
log_error error_messages
|
|
298
|
+
log_error error_messages.inspect
|
|
274
299
|
log_error backtrace
|
|
275
300
|
log_error "Request params were:"
|
|
276
301
|
log_error request_data.to_yaml
|
|
277
|
-
|
|
278
|
-
error_string = error_messages.first
|
|
279
|
-
else
|
|
280
|
-
error_string = error_messages
|
|
281
|
-
end
|
|
302
|
+
error_string = error_messages.first
|
|
282
303
|
else
|
|
283
304
|
status_code =
|
|
284
305
|
Wrangler::ExceptionHandler.status_code_for_exception(exception)
|
|
@@ -308,6 +329,7 @@ module Wrangler
|
|
|
308
329
|
error_messages,
|
|
309
330
|
proc_name,
|
|
310
331
|
backtrace,
|
|
332
|
+
supplementary_info,
|
|
311
333
|
status_code,
|
|
312
334
|
request_data)
|
|
313
335
|
else
|
|
@@ -317,6 +339,7 @@ module Wrangler
|
|
|
317
339
|
error_messages,
|
|
318
340
|
proc_name,
|
|
319
341
|
backtrace,
|
|
342
|
+
supplementary_info,
|
|
320
343
|
status_code,
|
|
321
344
|
request_data,
|
|
322
345
|
request)
|
|
@@ -62,6 +62,10 @@ module Wrangler
|
|
|
62
62
|
# - backtrace: the stack trace from the exception (passing in excplicitly
|
|
63
63
|
# because serializing the exception does not preserve the
|
|
64
64
|
# backtrace (in case delayed_job is used to async the email)
|
|
65
|
+
# - supplementary_info: any other messages to be dumped into the
|
|
66
|
+
# notification email. these are provided by the
|
|
67
|
+
# client code via the :call_for_supplementary_info
|
|
68
|
+
# option. can be a string or an array of strings.
|
|
65
69
|
# - status_code: the (string) http status code that the exception has been
|
|
66
70
|
# mapped to. Optional, but no default is provided, so
|
|
67
71
|
# no status code info will be contained in the email.
|
|
@@ -78,6 +82,7 @@ module Wrangler
|
|
|
78
82
|
additional_messages,
|
|
79
83
|
proc_name,
|
|
80
84
|
backtrace,
|
|
85
|
+
supplementary_info,
|
|
81
86
|
status_code = nil,
|
|
82
87
|
request_data = nil,
|
|
83
88
|
request = nil)
|
|
@@ -102,6 +107,7 @@ module Wrangler
|
|
|
102
107
|
:error_message => error_message,
|
|
103
108
|
:additional_messages => additional_messages,
|
|
104
109
|
:backtrace => backtrace,
|
|
110
|
+
:supplementary_info => supplementary_info,
|
|
105
111
|
:status_code => status_code,
|
|
106
112
|
:request_data => request_data,
|
|
107
113
|
:request => request
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
<%= @protocol %><%= @host %><%= @uri %>
|
|
9
9
|
<% end -%>
|
|
10
10
|
|
|
11
|
+
At <%= Time.now %>:
|
|
12
|
+
|
|
11
13
|
<% if !@exception_classname.nil? -%>
|
|
12
14
|
A/an <%= @exception_classname %> occurred:
|
|
13
15
|
<% else -%>
|
|
@@ -55,3 +57,12 @@ REQUEST DATA
|
|
|
55
57
|
<%= "#{k}: #{@request_data[k].inspect}" %>
|
|
56
58
|
<% end -%>
|
|
57
59
|
<% end -%>
|
|
60
|
+
|
|
61
|
+
<% unless @supplementary_info.blank? -%>
|
|
62
|
+
--------------------------------------------------
|
|
63
|
+
SUPPLEMENTARY INFO
|
|
64
|
+
--------------------------------------------------
|
|
65
|
+
<% @supplementary_info.each do |line| -%>
|
|
66
|
+
<%= line %>
|
|
67
|
+
<% end -%>
|
|
68
|
+
<% end -%>
|
data/wrangler.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{wrangler}
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.21"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Brian Percival"]
|
|
12
|
-
s.date = %q{2010-05-
|
|
12
|
+
s.date = %q{2010-05-18}
|
|
13
13
|
s.description = %q{A gem for handling exceptions thrown inside your Rails app. If you include the
|
|
14
14
|
gem in your application controller, wrangler will render the error pages you
|
|
15
15
|
configure for each exception or HTTP error code. It will also handle notifying
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wrangler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Percival
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2010-05-
|
|
12
|
+
date: 2010-05-18 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|