super_exception_notifier 3.0.16 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f8b0247e2462146eb4b943eb720ec55fcc0e6d4
4
- data.tar.gz: 5d4c11443936fa2b8edeb83bdd053f0cc73dc87f
3
+ metadata.gz: 53acfe8d674c8785ece68fa6c6100d900cb36de7
4
+ data.tar.gz: 5a20baccf5fefd0ddc7b11a83be5a195e56e9e76
5
5
  SHA512:
6
- metadata.gz: f05ac1ad139780aff29112bb45bf7e0832a4e2246096555a0bb46df6d286d06769acf8b89a6b3373ddb3b7487536887b39cb439f70f65583e346f5593e93993b
7
- data.tar.gz: b2e8ee968254fe472cdbea04a617d9790899d5a0dde2547727223f2df540da9773ed6a25cb588d9d83b715cadebadc90df56f72aa3bc6307ca632f2877c76191
6
+ metadata.gz: 6a6d8325445fb7f4d04be4f09aee510e641b917526ec2d678b5f4cbb01675a233285fb865912cf34ff66d40aed4cc3aed11ed3b9cdba9498518b9495d73ae2bf
7
+ data.tar.gz: 87ec579a8b51aefae4db68acfb9b15e1b2d32951c429cf87214905206152d36b87c68741e6902a5cfe831a77e3c0357434418aab9b5023233b4aa68aff980df0
@@ -1,3 +1,8 @@
1
+ 2014-01-18 v3.1
2
+ - Lots of refactoring, mostly in the test suite by Peter Boling
3
+ - Now tested against Rails 2.3 and 2.2 by Peter Boling
4
+ - Still 2 failing tests on Rails 2.1 and 2.0
5
+
1
6
  2014-01-18 v3.0.16
2
7
  - Fixed all the URLs in the Readme.
3
8
 
data/README.md CHANGED
@@ -171,7 +171,8 @@ For example:
171
171
  ## References
172
172
 
173
173
  * [Source Code](http://github.com/pboling/exception_notification)
174
- * [A fork from the my original source on Google Code](https://github.com/vitaliel/super_exception_notifier)
174
+ * [A popular fork/rewrite of this fork](https://github.com/bmpercy/wrangler)
175
+ * [An old fork of my original source on Google Code](https://github.com/vitaliel/super_exception_notifier)
175
176
  * [The Original Source on Google Code](http://super-exception-notifier.googlecode.com/svn/trunk/super_exception_notifier/)
176
177
  * [Getting it to work on Stack Overflow & my response](http://stackoverflow.com/questions/1738017/getting-super-exception-notifier-to-work)
177
178
  * [Getting it to work on PasteBin](http://pastebin.com/pyHQjN84)
data/Rakefile CHANGED
@@ -2,7 +2,6 @@
2
2
  require "bundler/gem_tasks"
3
3
  require 'rake'
4
4
  require 'rake/testtask'
5
- require 'rake/rdoctask'
6
5
 
7
6
  desc 'Default: run unit tests.'
8
7
  task :default => :test
@@ -14,6 +13,16 @@ Rake::TestTask.new do |t|
14
13
  t.verbose = true
15
14
  end
16
15
 
16
+ namespace :test do
17
+ desc 'Test against all supported Rails versions'
18
+ task :all do
19
+ %w(2.0.x 2.1.x 2.2.x 2.3.x).each do |version|
20
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.rails-#{version}' bundle --quiet"
21
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.rails-#{version}' bundle exec rake test"
22
+ end
23
+ end
24
+ end
25
+
17
26
  require 'reek/rake/task'
18
27
  Reek::Rake::Task.new do |t|
19
28
  t.fail_on_error = true
@@ -27,9 +36,12 @@ RoodiTask.new do |t|
27
36
  t.verbose = false
28
37
  end
29
38
 
39
+
30
40
  desc 'Generate documentation for exception_notifiable gem.'
31
41
  require File.expand_path('../lib/super_exception_notifier/version', __FILE__)
32
- Rake::RDocTask.new do |rdoc|
42
+ require 'rdoc'
43
+ require 'rdoc/task'
44
+ RDoc::Task.new do |rdoc|
33
45
  rdoc.rdoc_dir = 'rdoc'
34
46
  rdoc.title = "exception_notifiable #{SuperExceptionNotifier::VERSION}"
35
47
  rdoc.options << '--line-numbers' << '--inline-source'
@@ -10,14 +10,14 @@ module ExceptionNotification::ExceptionNotifiable
10
10
 
11
11
  # Sets up an alias chain to catch exceptions when Rails does
12
12
  #This is what makes it all work with Hoptoad or other exception catchers.
13
- # base.send(:alias_method, :rescue_action_locally_without_sen_handler, :rescue_action_locally)
14
- # base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_sen_handler)
13
+ #base.send(:alias_method, :rescue_action_locally_without_sen_handler, :rescue_action_locally)
14
+ #base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_sen_handler)
15
15
 
16
16
  #Alias method chaining doesn't work here because it would trigger a double render error.
17
17
  # Sets up an alias chain to catch exceptions when Rails does
18
18
  #This is what makes it all work with Hoptoad or other exception catchers.
19
- # base.send(:alias_method, :rescue_action_in_public_without_exception_notifiable, :rescue_action_in_public)
20
- # base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_exception_notifiable)
19
+ #base.send(:alias_method, :rescue_action_in_public_without_exception_notifiable, :rescue_action_in_public)
20
+ #base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_exception_notifiable)
21
21
 
22
22
  # Adds the following class attributes to the classes that include ExceptionNotifiable
23
23
  # HTTP status codes and what their 'English' status message is
@@ -90,7 +90,7 @@ module ExceptionNotification::ExceptionNotifiable
90
90
  def environment_is_noisy?
91
91
  self.class.exception_notifiable_noisy_environments.include?(Rails.env)
92
92
  end
93
-
93
+
94
94
  def notification_level_sends_email?
95
95
  self.class.exception_notifiable_notification_level.include?(:email)
96
96
  end
@@ -115,7 +115,8 @@ module ExceptionNotification::ExceptionNotifiable
115
115
  # Or when the error occurs somewhere without a subsequent render (eg. method calls in console)
116
116
  def rescue_with_handler(exception)
117
117
  to_return = super
118
- if to_return
118
+ # Not sure how to do this. We aren't supposed to rely on the return value of the super handler.
119
+ #if to_return
119
120
  verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?
120
121
  logger.info("[RESCUE STYLE] rescue_with_handler") if verbose
121
122
  data = get_exception_data
@@ -133,7 +134,7 @@ module ExceptionNotification::ExceptionNotifiable
133
134
  # Send Web Hook requests
134
135
  ExceptionNotification::HooksNotifier.deliver_exception_to_web_hooks(ExceptionNotification::Notifier.config, exception, self, request, data, the_blamed) if send_web_hooks
135
136
  pass_it_on(exception, ENV, verbose)
136
- end
137
+ #end
137
138
  to_return
138
139
  end
139
140
 
@@ -141,6 +142,7 @@ module ExceptionNotification::ExceptionNotifiable
141
142
  # any custom processing that is defined with Rails 2's exception helpers.
142
143
  # When the action being executed is letting SEN handle the exception completely
143
144
  def rescue_action_in_public(exception)
145
+ logger.info "rescue_action_in_public"
144
146
  # If the error class is NOT listed in the rails_error_class hash then we get a generic 500 error:
145
147
  # OTW if the error class is listed, but has a blank code or the code is == '200' then we get a custom error layout rendered
146
148
  # OTW the error class is listed!
@@ -156,6 +158,7 @@ module ExceptionNotification::ExceptionNotifiable
156
158
  end
157
159
 
158
160
  def notify_and_render_error_template(status_cd, request, exception, file_path, verbose = false)
161
+ logger.info "notify_and_render_error_template"
159
162
  status = self.class.http_status_codes[status_cd] ? status_cd + " " + self.class.http_status_codes[status_cd] : status_cd
160
163
  data = get_exception_data
161
164
  #We only send email if it has been configured in environment
@@ -2,7 +2,7 @@
2
2
  #Released under the MIT license
3
3
 
4
4
  module ExceptionNotification::HelpfulHashes
5
- unless defined?(SILENT_EXCEPTIONS)
5
+ SILENT_EXCEPTIONS = begin
6
6
  noiseless = []
7
7
  noiseless << ActiveRecord::RecordNotFound if defined?(ActiveRecord)
8
8
  if defined?(ActionController)
@@ -11,7 +11,7 @@ module ExceptionNotification::HelpfulHashes
11
11
  noiseless << ActionController::RoutingError
12
12
  noiseless << ActionController::MethodNotAllowed
13
13
  end
14
- SILENT_EXCEPTIONS = noiseless
14
+ noiseless
15
15
  end
16
16
 
17
17
  # TODO: use ActionController::StatusCodes
@@ -27,7 +27,7 @@ module ExceptionNotification::HelpfulHashes
27
27
  "500" => "Internal Server Error",
28
28
  "501" => "Not Implemented",
29
29
  "503" => "Service Unavailable"
30
- } unless defined?(HTTP_STATUS_CODES)
30
+ }
31
31
 
32
32
  def codes_for_error_classes
33
33
  #TODO: Format whitespace
@@ -55,7 +55,7 @@ module ExceptionNotification::Notifiable
55
55
  private
56
56
 
57
57
  def environment_is_noisy?
58
- self.notifiable_noisy_environments.include?(Rails.env)
58
+ self.class.notifiable_noisy_environments.include?(Rails.env) if defined?(Rails)
59
59
  end
60
60
 
61
61
  def notification_level_sends_email?
@@ -27,29 +27,29 @@ module ExceptionNotification::NotifiableHelper
27
27
  end
28
28
 
29
29
  def verbose_output(exception, status_cd, file_path, send_email, send_web_hooks, request = nil, the_blamed = nil, rejected_sections = nil)
30
- logger.info("[EXCEPTION] #{exception}")
31
- logger.info("[EXCEPTION CLASS] #{exception.class}")
32
- logger.info("[EXCEPTION STATUS_CD] #{status_cd}")
33
- logger.info("[ERROR LAYOUT] #{self.class.error_layout}") if self.class.respond_to?(:error_layout)
34
- logger.info("[ERROR VIEW PATH] #{ExceptionNotification::Notifier.config[:view_path]}") if !ExceptionNotification::Notifier.nil? && !ExceptionNotification::Notifier.config[:view_path].nil?
35
- logger.info("[ERROR FILE PATH] #{file_path.inspect}")
36
- logger.info("[ERROR EMAIL] #{send_email ? "YES" : "NO"}")
37
- logger.info("[ERROR WEB HOOKS] #{send_web_hooks ? "YES" : "NO"}")
38
- logger.info("[THE BLAMED] #{the_blamed}") unless the_blamed.blank?
39
- logger.info("[SECTIONS] #{ExceptionNotification::Notifier.sections_for_email(rejected_sections, request).inspect}")
30
+ puts("[EXCEPTION] #{exception}")
31
+ puts("[EXCEPTION CLASS] #{exception.class}")
32
+ puts("[EXCEPTION STATUS_CD] #{status_cd}")
33
+ puts("[ERROR LAYOUT] #{self.class.error_layout}") if self.class.respond_to?(:error_layout)
34
+ puts("[ERROR VIEW PATH] #{ExceptionNotification::Notifier.config[:view_path]}") if !ExceptionNotification::Notifier.nil? && !ExceptionNotification::Notifier.config[:view_path].nil?
35
+ puts("[ERROR FILE PATH] #{file_path.inspect}")
36
+ puts("[ERROR EMAIL] #{send_email ? "YES" : "NO"}")
37
+ puts("[ERROR WEB HOOKS] #{send_web_hooks ? "YES" : "NO"}")
38
+ puts("[THE BLAMED] #{the_blamed}") unless the_blamed.blank?
39
+ puts("[SECTIONS] #{ExceptionNotification::Notifier.sections_for_email(rejected_sections, request).inspect}")
40
40
  req = request ? " for request_uri=#{request.request_uri}" : ""
41
41
  logger.error("render_error(#{status_cd}, #{self.class.http_status_codes[status_cd]}) invoked#{req}") if self.class.respond_to?(:http_status_codes)
42
42
  end
43
43
 
44
44
  def perform_exception_notify_mailing(exception, data, request = nil, the_blamed = nil, verbose = false, rejected_sections = nil)
45
45
  if ExceptionNotification::Notifier.config[:exception_recipients].blank?
46
- logger.info("[EMAIL NOTIFICATION] ExceptionNotification::Notifier.config[:exception_recipients] is blank, notification cancelled!") if verbose
46
+ puts("[EMAIL NOTIFICATION] ExceptionNotification::Notifier.config[:exception_recipients] is blank, notification cancelled!") if verbose
47
47
  else
48
48
  class_name = self.respond_to?(:controller_name) ? self.controller_name : self.to_s
49
49
  method_name = self.respond_to?(:action_name) ? self.action_name : get_method_name
50
50
  ExceptionNotification::Notifier.deliver_exception_notification(exception, class_name, method_name,
51
51
  request, data, the_blamed, rejected_sections)
52
- logger.info("[EMAIL NOTIFICATION] Sent") if verbose
52
+ puts("[EMAIL NOTIFICATION] Sent") if verbose
53
53
  end
54
54
  end
55
55
 
@@ -65,7 +65,7 @@ module ExceptionNotification::NotifiableHelper
65
65
  def should_notify_on_exception?(exception, status_cd = nil, verbose = false)
66
66
  # don't notify (email or web hooks) on exceptions raised locally
67
67
  verbose && ExceptionNotification::Notifier.config[:skip_local_notification] && is_local? ?
68
- logger.info("[NOTIFY LOCALLY] NO") :
68
+ puts("[NOTIFY LOCALLY] NO") :
69
69
  nil
70
70
  return false if ExceptionNotification::Notifier.config[:skip_local_notification] && is_local?
71
71
  # don't notify (email or web hooks) exceptions raised that match ExceptionNotifiable.notifiable_silent_exceptions
@@ -1,5 +1,5 @@
1
1
  module SuperExceptionNotifier
2
2
 
3
- VERSION = '3.0.16'
3
+ VERSION = '3.1.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_exception_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.16
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: "2.3"
49
+ version: "2.0"
50
50
  - - <
51
51
  - !ruby/object:Gem::Version
52
52
  version: "3"
@@ -69,10 +69,7 @@ dependencies:
69
69
  requirements:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: "0.8"
73
- - - <
74
- - !ruby/object:Gem::Version
75
- version: "0.9"
72
+ version: 10.1.1
76
73
  type: :development
77
74
  version_requirements: *id005
78
75
  - !ruby/object:Gem::Dependency