super_exception_notifier 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +27 -16
- data/VERSION.yml +2 -1
- data/test/notifiable_test.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -38,13 +38,13 @@ a dozen or so other forks. It remains a (mostly) drop in replacement with great
|
|
38
38
|
functionality and customization options. I keep it up to date with the work on the core team's
|
39
39
|
branch.
|
40
40
|
|
41
|
-
The original is here:
|
41
|
+
The venerable original is here:
|
42
42
|
|
43
43
|
http://github.com/rails/exception_notification/tree/master
|
44
44
|
|
45
45
|
The current version of this gem is a git fork of the original and
|
46
46
|
has been updated to include the latest improvements from the original,
|
47
|
-
including
|
47
|
+
including compatibility with Rails 2.1, 2.2, 2.3, and perhaps 3.0, as well as many improvements from
|
48
48
|
the other forks on github. I merge them in when I have time, and when the
|
49
49
|
changes fit nicely with the enhancements I have already made.
|
50
50
|
|
@@ -176,7 +176,7 @@ In any controller you do this:
|
|
176
176
|
|
177
177
|
Then that controller (or all of them if you put it in the application controller) will have its errors handled by SEN.
|
178
178
|
You can customize how each controller handles exceptions on a per controller basis, or all together in the application controller.
|
179
|
-
The available configuration options are shown with their default settings:
|
179
|
+
The available configuration options are shown with their default settings, pulled from the gem's source:
|
180
180
|
|
181
181
|
# HTTP status codes and what their 'English' status message is
|
182
182
|
self.http_status_codes = {
|
@@ -217,7 +217,7 @@ The available configuration options are shown with their default settings:
|
|
217
217
|
MethodDisabled => "200"
|
218
218
|
}
|
219
219
|
|
220
|
-
# Highly dependent on the
|
220
|
+
# Highly dependent on the version of rails, so we're very protective about these'
|
221
221
|
self.error_class_status_codes.merge!({ ActionView::TemplateError => "500"}) if defined?(ActionView) && ActionView.const_defined?(:TemplateError)
|
222
222
|
self.error_class_status_codes.merge!({ ActiveRecord::RecordNotFound => "400" }) if defined?(ActiveRecord) && ActiveRecord.const_defined?(:RecordNotFound)
|
223
223
|
self.error_class_status_codes.merge!({ ActiveResource::ResourceNotFound => "404" }) if defined?(ActiveResource) && ActiveResource.const_defined?(:ResourceNotFound)
|
@@ -359,12 +359,12 @@ Email will be sent if the error matches one of the error classes to send email f
|
|
359
359
|
You can also customize what is rendered. SuperExceptionNotifier will render the first file it finds in this order:
|
360
360
|
|
361
361
|
#{RAILS_ROOT}/public/###.html
|
362
|
-
#{RAILS_ROOT}/#ExceptionNotifier.config[:view_path]}/###.html
|
362
|
+
#{RAILS_ROOT}/#{ExceptionNotifier.config[:view_path]}/###.html
|
363
363
|
#{this gem's root}/rails/app/views/exception_notifiable/#{status_cd}.html
|
364
364
|
|
365
365
|
And if none of those paths has a valid file to render, this one wins:
|
366
366
|
|
367
|
-
#{
|
367
|
+
#{this gem's root}/rails/app/views/exception_notifiable/500.html
|
368
368
|
|
369
369
|
You can configure ExceptionNotifier.config[:view_path] in your environment file like this:
|
370
370
|
|
@@ -386,7 +386,7 @@ You can render CUSTOM error pages! Here's how:
|
|
386
386
|
* ExceptionNotifier.config[:view_path] = 'app/views/error'
|
387
387
|
5. Create a view for the error. SuperExceptionNotifier munges the error's class by converting to a string and then replacing consecutive ':' with '' and then downcases it:
|
388
388
|
* touch app/views/error/insufficient_funds_for_withdrawal.html
|
389
|
-
6. If you want a custom layout (by default it will render the error with the
|
389
|
+
6. If you want a custom layout (by default it will render the error with the layout the controller is using) you just need to set, in application.rb (or per-controller):
|
390
390
|
* self.error_layout = 'my_error_layout' #or = true for the same layout as the controller, or = false for no layout
|
391
391
|
7. That's it! All errors that are set to be handled with a status of "200" will render a custom page.
|
392
392
|
8. If you want to have errors that render custom pages also send emails then you'll need to:
|
@@ -446,7 +446,7 @@ in ExceptionNotifiable for an example of how to go about that.
|
|
446
446
|
|
447
447
|
== HTTP Error Codes Used by SEN by default
|
448
448
|
|
449
|
-
For reference these are the error codes that SEN can inherently handle.
|
449
|
+
For reference these are the error codes that SEN can inherently handle, and they were gleaned from the following two websites.
|
450
450
|
Official w3.org HTTP 1.1 Error Codes:
|
451
451
|
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
452
452
|
Not all the error codes in use today are on that list, so here's Apache's list:
|
@@ -483,7 +483,7 @@ in ExceptionNotifiable for an example of how to go about that.
|
|
483
483
|
== CSS
|
484
484
|
|
485
485
|
All the standard error pages that come in the gem render a div with a class of "dialog",
|
486
|
-
so put this in a stylesheet you are including in your app to get you started (like
|
486
|
+
so put this in a stylesheet you are including in your app to get you started (like standard rails error style):
|
487
487
|
|
488
488
|
<style type="text/css">
|
489
489
|
div.dialog {
|
@@ -497,16 +497,23 @@ so put this in a stylesheet you are including in your app to get you started (li
|
|
497
497
|
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
498
498
|
</style>
|
499
499
|
|
500
|
-
|
501
|
-
|
502
|
-
|
500
|
+
== Authors
|
501
|
+
|
502
|
+
Jamis Buck and Peter Boling
|
503
|
+
|
504
|
+
== Contributors
|
503
505
|
|
506
|
+
I've merged many other people's forks into my fork. Thanks to all of you who contributed good ideas that I have ripped off!
|
507
|
+
|
508
|
+
If I fail to mention you below, please let me know.
|
509
|
+
|
510
|
+
jamescook, ismasan, sentientmonkey
|
511
|
+
|
504
512
|
== jamescook changes
|
505
513
|
|
506
514
|
Hooks into `git blame` output so you can get an idea of who (may) have introduced the bug :)
|
507
515
|
-- Usage: set ExceptionNotifier.config[:git_repo_path] to the path of your git repo.
|
508
516
|
|
509
|
-
|
510
517
|
== ismasan changes
|
511
518
|
|
512
519
|
POST exception data in JSON format to the specified services for processing
|
@@ -520,9 +527,13 @@ POST exception data in JSON format to the specified services for processing
|
|
520
527
|
|
521
528
|
== sentientmonkey changes
|
522
529
|
|
523
|
-
Now you can get notifications from rake tasks!
|
524
|
-
|
525
|
-
|
530
|
+
Now you can get notifications from rake tasks! Use 'NotifiedTask.new' instead of 'task':
|
531
|
+
-- Usage:
|
526
532
|
NotifiedTask.new :sometask => :environment do
|
527
533
|
puts "I'm a task"
|
528
534
|
end
|
535
|
+
|
536
|
+
== Copyright
|
537
|
+
|
538
|
+
Copyright (c) 2008-9 Peter H. Boling, released under the MIT license
|
539
|
+
Portions Copyright (c) 2005 Jamis Buck, released under the MIT license
|
data/VERSION.yml
CHANGED
data/test/notifiable_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
|
3
3
|
require 'test/unit'
|
4
4
|
|
5
5
|
class Spaceship
|
6
|
-
# It is included by the init.rb in
|
6
|
+
# It is included by the init.rb in the Object super class,
|
7
7
|
# so we don't actually need to do anything to get notifiable { method } goodness.
|
8
8
|
#include Notifiable
|
9
9
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2009-
|
16
|
+
date: 2009-11-04 00:00:00 -05:00
|
17
17
|
default_executable:
|
18
18
|
dependencies: []
|
19
19
|
|