wrangler 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -205,21 +205,24 @@ module Wrangler
205
205
 
206
206
  log_exception(exception, request_data, status_code)
207
207
 
208
+ exception_classname = exception.is_a?(Class) ? exception.name : exception.class.name
209
+ exception_string = exception.respond_to?(:to_str) ? exception.to_str : exception
210
+
208
211
  if notify_on_exception?(exception, status_code)
209
212
  if notify_with_delayed_job?
210
213
  # don't pass in request as it contains not-easily-serializable stuff
211
214
  log_error "Wrangler sending email notification asynchronously"
212
215
  Wrangler::ExceptionNotifier.send_later(:deliver_exception_notification,
213
- exception,
214
- exception.to_str,
216
+ exception_classname,
217
+ exception_string,
215
218
  proc_name,
216
219
  exception.backtrace,
217
220
  status_code,
218
221
  request_data)
219
222
  else
220
223
  log_error "Wrangler sending email notification synchronously"
221
- Wrangler::ExceptionNotifier.deliver_exception_notification(exception,
222
- exception.to_str,
224
+ Wrangler::ExceptionNotifier.deliver_exception_notification(exception_classname,
225
+ exception_string,
223
226
  proc_name,
224
227
  exception.backtrace,
225
228
  status_code,
@@ -52,7 +52,8 @@ module Wrangler
52
52
  # when you call ExceptionNotifier.deliver_exception_notification())
53
53
  #
54
54
  # arguments:
55
- # - exception: the exception that was raised
55
+ # - exception_classname: the class of exception that was raised
56
+ # - exception_message: the error message carried by the exception
56
57
  # - proc_name: the name of the process in which the exception arised
57
58
  # - backtrace: the stack trace from the exception (passing in excplicitly
58
59
  # because serializing the exception does not preserve the
@@ -68,7 +69,7 @@ module Wrangler
68
69
  # be nil and MUST be nil if calling this method with
69
70
  # delayed_job. Optional.
70
71
  #---------------------------------------------------------------------------
71
- def exception_notification(exception,
72
+ def exception_notification(exception_classname,
72
73
  exception_message,
73
74
  proc_name,
74
75
  backtrace,
@@ -92,7 +93,7 @@ module Wrangler
92
93
  # scrutinize any use of @request in the views!
93
94
 
94
95
  body_hash =
95
- { :exception => exception,
96
+ { :exception_classname => exception_classname,
96
97
  :exception_message => exception_message,
97
98
  :backtrace => backtrace,
98
99
  :status_code => status_code,
@@ -105,7 +106,7 @@ module Wrangler
105
106
  recipients config[:recipient_addresses]
106
107
  subject "[#{proc_name + (proc_name ? ' ' : '')}" +
107
108
  "#{config[:subject_prefix]}] " +
108
- "#{exception.class.name}: " +
109
+ "#{exception_classname}: " +
109
110
  "#{exception_message}"
110
111
  body body_hash
111
112
  sent_on Time.now
@@ -62,7 +62,7 @@ module Wrangler
62
62
  def log_exception(exception, request_data = nil, status_code = nil)
63
63
  msgs = []
64
64
  msgs << "An exception was caught (#{exception.class.name}):"
65
- msgs << exception.to_str
65
+ msgs << exception.respond_to?(:to_str) ? exception.to_str : exception
66
66
 
67
67
  unless request_data.blank?
68
68
  msgs << "Request params were:"
data/lib/wrangler.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'wrangler/wrangler_helper.rb'
2
2
  require 'wrangler/exception_handler.rb'
3
3
  require 'wrangler/exception_notifier.rb'
4
+ require 'wrangler/wrangler_exceptions.rb'
4
5
 
5
6
  module Wrangler
6
7
 
@@ -8,7 +8,7 @@
8
8
  <%= @protocol %><%= @host %><%= @uri %>
9
9
  <% end -%>
10
10
 
11
- A <%= @exception.class %> occurred:
11
+ A <%= @exception_classname %> occurred:
12
12
  * <%= @exception_message %>
13
13
  in <%= @backtrace.first %>
14
14
 
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.10"
8
+ s.version = "0.1.11"
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{2009-11-30}
12
+ s.date = %q{2009-12-06}
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.10
4
+ version: 0.1.11
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: 2009-11-30 00:00:00 -08:00
12
+ date: 2009-12-06 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency