super_exception_notifier 2.0.0
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.
- data/MIT-LICENSE +21 -0
- data/README.rdoc +528 -0
- data/VERSION.yml +4 -0
- data/init.rb +1 -0
- data/lib/exception_notifiable.rb +175 -0
- data/lib/exception_notifier.rb +185 -0
- data/lib/exception_notifier_helper.rb +60 -0
- data/lib/notifiable.rb +91 -0
- data/lib/super_exception_notifier/custom_exception_classes.rb +16 -0
- data/lib/super_exception_notifier/custom_exception_methods.rb +50 -0
- data/lib/super_exception_notifier/deprecated_methods.rb +60 -0
- data/lib/super_exception_notifier/git_blame.rb +52 -0
- data/lib/super_exception_notifier/helpful_hashes.rb +66 -0
- data/lib/super_exception_notifier/hooks_notifier.rb +55 -0
- data/lib/super_exception_notifier/notifiable_helper.rb +79 -0
- data/rails/app/views/exception_notifiable/400.html +5 -0
- data/rails/app/views/exception_notifiable/403.html +6 -0
- data/rails/app/views/exception_notifiable/404.html +6 -0
- data/rails/app/views/exception_notifiable/405.html +6 -0
- data/rails/app/views/exception_notifiable/410.html +7 -0
- data/rails/app/views/exception_notifiable/418.html +6 -0
- data/rails/app/views/exception_notifiable/422.html +5 -0
- data/rails/app/views/exception_notifiable/423.html +6 -0
- data/rails/app/views/exception_notifiable/501.html +8 -0
- data/rails/app/views/exception_notifiable/503.html +6 -0
- data/rails/app/views/exception_notifiable/method_disabled.html.erb +6 -0
- data/rails/init.rb +25 -0
- data/tasks/notified_task.rake +15 -0
- data/test/exception_notifiable_test.rb +34 -0
- data/test/exception_notifier_helper_test.rb +76 -0
- data/test/exception_notifier_test.rb +41 -0
- data/test/exception_notify_functional_test.rb +139 -0
- data/test/mocks/controllers.rb +82 -0
- data/test/notifiable_test.rb +79 -0
- data/test/test_helper.rb +32 -0
- data/views/exception_notifier/_backtrace.html.erb +1 -0
- data/views/exception_notifier/_environment.html.erb +14 -0
- data/views/exception_notifier/_inspect_model.html.erb +16 -0
- data/views/exception_notifier/_request.html.erb +8 -0
- data/views/exception_notifier/_session.html.erb +6 -0
- data/views/exception_notifier/_title.html.erb +3 -0
- data/views/exception_notifier/background_exception_notification.text.plain.erb +10 -0
- data/views/exception_notifier/exception_notification.text.plain.erb +15 -0
- metadata +119 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
require 'active_support'
|
5
|
+
require 'actionmailer'
|
6
|
+
require 'active_record'
|
7
|
+
|
8
|
+
#just requiring active record wasn't loading classes soon enough for SILENT_EXCEPTIONS
|
9
|
+
ActiveRecord::Base
|
10
|
+
|
11
|
+
require 'action_controller'
|
12
|
+
require 'action_controller/test_case'
|
13
|
+
require 'action_controller/test_process'
|
14
|
+
|
15
|
+
#just requiring action controller wasn't loading classes soon enough for SILENT_EXCEPTIONS
|
16
|
+
ActionController::Base
|
17
|
+
|
18
|
+
RAILS_ROOT = '.' unless defined?(RAILS_ROOT)
|
19
|
+
RAILS_ENV = 'test' unless defined?(RAILS_ENV)
|
20
|
+
RAILS_DEFAULT_LOGGER = Logger.new(StringIO.new) unless defined?(RAILS_DEFAULT_LOGGER)
|
21
|
+
#$:.unshift File.join(File.dirname(__FILE__), '../lib')
|
22
|
+
|
23
|
+
require File.join(File.dirname(__FILE__), "..", "init")
|
24
|
+
|
25
|
+
ExceptionNotifier.configure_exception_notifier do |config|
|
26
|
+
# If left empty web hooks will not be engaged
|
27
|
+
config[:web_hooks] = []
|
28
|
+
config[:exception_recipients] = ["test.errors@example.com"]
|
29
|
+
config[:view_path] = File.join(File.dirname(__FILE__), "mocks")
|
30
|
+
config[:skip_local_notification] = false
|
31
|
+
config[:notify_other_errors] = true
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= @backtrace.join "\n" %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% if @request -%>
|
2
|
+
<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%>
|
3
|
+
<% @request.env.keys.sort.each do |key| -%>
|
4
|
+
* <%= "%-*s: %s" % [max.length, key, filter_sensitive_post_data_from_env(key, @request.env[key].to_s.strip)] %>
|
5
|
+
<% end -%>
|
6
|
+
<% end -%>
|
7
|
+
<% if @data -%>
|
8
|
+
<% @data.each do |key, value| -%>
|
9
|
+
* <%= key %>: <%= value %>
|
10
|
+
<% end -%>
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
* Process: <%= $$ %>
|
14
|
+
* Server : <%= `hostname -s`.chomp %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% if show_attributes -%>
|
2
|
+
[attributes]
|
3
|
+
<% attrs = inspect_model.attributes -%>
|
4
|
+
<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%>
|
5
|
+
<% attrs.keys.sort.each do |attr| -%>
|
6
|
+
* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ").strip] %>
|
7
|
+
<% end -%>
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
<% if show_instance_variables -%>
|
11
|
+
[instance variables]
|
12
|
+
<% inspect_model.instance_variables.sort.each do |variable| -%>
|
13
|
+
<%- next if variable == "@attributes" -%>
|
14
|
+
* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %>
|
15
|
+
<% end -%>
|
16
|
+
<% end -%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% if @request -%>
|
2
|
+
* URL : <%= @request.protocol %><%= @host %><%= @request.request_uri %>
|
3
|
+
* Method : <%= @request.method.to_s.upcase %>
|
4
|
+
* IP address: <%= @request.env['HTTP_X_REAL_IP'] ||@request.env["HTTP_X_FORWARDED_FOR"] || @request.env["REMOTE_ADDR"] %>
|
5
|
+
* Parameters: <%= filter_sensitive_post_data_parameters(@request.parameters).inspect %>
|
6
|
+
<% end -%>
|
7
|
+
* Rails root: <%= @rails_root %>
|
8
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%
|
2
|
+
@request.session.instance_variable_set(:@session_id, @request.session_options[:id]) if @request.session.instance_variable_get(:@session_id).nil?
|
3
|
+
@request.session.instance_variable_set(:@data, @request.session.to_hash) if @request.session.instance_variable_get(:@data).nil?
|
4
|
+
%>
|
5
|
+
* session id: <%= @request.session.instance_variable_get(:@session_id).inspect %>
|
6
|
+
* data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
A <%= @exception.class %> occurred in <%= @controller_name %>#<%= @controller_action_name %>:
|
2
|
+
|
3
|
+
<%= @exception.message %>
|
4
|
+
<%= @backtrace.first %>
|
5
|
+
|
6
|
+
<% if @data[:info] -%>
|
7
|
+
<%=@data[:info].to_yaml%>
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
<%= @sections.map { |section| render_section(section) }.join %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% unless @request.nil? -%>
|
2
|
+
<%= @request.protocol %><%= @host %><%= @request.request_uri %>
|
3
|
+
<% end -%>
|
4
|
+
A <%= @exception.class %> occurred in <%= @location %>:
|
5
|
+
<%= @exception.message %>
|
6
|
+
<%= @backtrace.first %>
|
7
|
+
|
8
|
+
<% if @data[:info] -%>
|
9
|
+
<%=@data[:info].to_yaml%>
|
10
|
+
<% end -%>
|
11
|
+
|
12
|
+
<% unless @the_blamed.nil? || @the_blamed[:author].nil? %>
|
13
|
+
Git Blame: '<%=@the_blamed[:author]%>' last modified line #<%=@the_blamed[:line]%> in <%=@the_blamed[:file]%>
|
14
|
+
<% end%>
|
15
|
+
<%= @sections.map { |section| render_section(section) }.join %>
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: super_exception_notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Boling
|
8
|
+
- Scott Windsor
|
9
|
+
- Ismael Celis
|
10
|
+
- Jacques Crocker
|
11
|
+
- Jamis Buck
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
|
16
|
+
date: 2009-10-22 00:00:00 -04:00
|
17
|
+
default_executable:
|
18
|
+
dependencies: []
|
19
|
+
|
20
|
+
description: |-
|
21
|
+
Allows customization of:
|
22
|
+
* Specify which level of notification you would like with an array of optional styles of notification (email, webhooks)
|
23
|
+
* the sender address of the email
|
24
|
+
* the recipient addresses
|
25
|
+
* the text used to prefix the subject line
|
26
|
+
* the HTTP status codes to notify for
|
27
|
+
* the error classes to send emails for
|
28
|
+
* alternatively, the error classes to not notify for
|
29
|
+
* whether to send error emails or just render without sending anything
|
30
|
+
* the HTTP status and status code that gets rendered with specific errors
|
31
|
+
* the view path to the error page templates
|
32
|
+
* custom errors, with custom error templates
|
33
|
+
* define error layouts at application or controller level, or use the controller's own default layout, or no layout at all
|
34
|
+
* get error notification for errors that occur in the console, using notifiable method
|
35
|
+
* Override the gem's handling and rendering with explicit rescue statements inline.
|
36
|
+
* Hooks into `git blame` output so you can get an idea of who (may) have introduced the bug
|
37
|
+
* Hooks into other website services (e.g. you can send exceptions to to Switchub.com)
|
38
|
+
* Can notify of errors occurring in any class/method using notifiable { method }
|
39
|
+
* Can notify of errors in Rake tasks using NotifiedTask.new instead of task
|
40
|
+
email: peter.boling@gmail.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.rdoc
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.rdoc
|
50
|
+
- VERSION.yml
|
51
|
+
- init.rb
|
52
|
+
- lib/exception_notifiable.rb
|
53
|
+
- lib/exception_notifier.rb
|
54
|
+
- lib/exception_notifier_helper.rb
|
55
|
+
- lib/notifiable.rb
|
56
|
+
- lib/super_exception_notifier/custom_exception_classes.rb
|
57
|
+
- lib/super_exception_notifier/custom_exception_methods.rb
|
58
|
+
- lib/super_exception_notifier/deprecated_methods.rb
|
59
|
+
- lib/super_exception_notifier/git_blame.rb
|
60
|
+
- lib/super_exception_notifier/helpful_hashes.rb
|
61
|
+
- lib/super_exception_notifier/hooks_notifier.rb
|
62
|
+
- lib/super_exception_notifier/notifiable_helper.rb
|
63
|
+
- rails/app/views/exception_notifiable/400.html
|
64
|
+
- rails/app/views/exception_notifiable/403.html
|
65
|
+
- rails/app/views/exception_notifiable/404.html
|
66
|
+
- rails/app/views/exception_notifiable/405.html
|
67
|
+
- rails/app/views/exception_notifiable/410.html
|
68
|
+
- rails/app/views/exception_notifiable/418.html
|
69
|
+
- rails/app/views/exception_notifiable/422.html
|
70
|
+
- rails/app/views/exception_notifiable/423.html
|
71
|
+
- rails/app/views/exception_notifiable/501.html
|
72
|
+
- rails/app/views/exception_notifiable/503.html
|
73
|
+
- rails/app/views/exception_notifiable/method_disabled.html.erb
|
74
|
+
- rails/init.rb
|
75
|
+
- tasks/notified_task.rake
|
76
|
+
- views/exception_notifier/_backtrace.html.erb
|
77
|
+
- views/exception_notifier/_environment.html.erb
|
78
|
+
- views/exception_notifier/_inspect_model.html.erb
|
79
|
+
- views/exception_notifier/_request.html.erb
|
80
|
+
- views/exception_notifier/_session.html.erb
|
81
|
+
- views/exception_notifier/_title.html.erb
|
82
|
+
- views/exception_notifier/background_exception_notification.text.plain.erb
|
83
|
+
- views/exception_notifier/exception_notification.text.plain.erb
|
84
|
+
has_rdoc: true
|
85
|
+
homepage: http://github.com/pboling/exception_notification
|
86
|
+
licenses: []
|
87
|
+
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options:
|
90
|
+
- --charset=UTF-8
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: "0"
|
98
|
+
version:
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: "0"
|
104
|
+
version:
|
105
|
+
requirements: []
|
106
|
+
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 1.3.5
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: Allows unhandled (and handled!) exceptions to be captured and sent via email
|
112
|
+
test_files:
|
113
|
+
- test/exception_notifiable_test.rb
|
114
|
+
- test/exception_notifier_helper_test.rb
|
115
|
+
- test/exception_notifier_test.rb
|
116
|
+
- test/exception_notify_functional_test.rb
|
117
|
+
- test/mocks/controllers.rb
|
118
|
+
- test/notifiable_test.rb
|
119
|
+
- test/test_helper.rb
|