Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit cc9e15f

Browse files
committed
updating README with 404 and manual notification invocation
1 parent 68d5b2f commit cc9e15f

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

README

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,22 @@ In the above case, @document and @person would be made available to the email
119119
renderer, allowing your new section(s) to access and display them. See the
120120
existing sections defined by the plugin for examples of how to write your own.
121121

122-
== Advanced Customization
122+
== 404s errors
123123

124-
By default, the email notifier will only notify on critical errors. For
125-
ActiveRecord::RecordNotFound and ActionController::UnknownAction, it will
126-
simply render the contents of your public/404.html file. Other exceptions
127-
will render public/500.html and will send the email notification. If you want
128-
to use different rules for the notification, you will need to implement your
129-
own rescue_action_in_public method. You can look at the default implementation
130-
in ExceptionNotifiable for an example of how to go about that.
124+
Notification is skipped if you return a 404 status, which happens by default
125+
for an ActiveRecord::RecordNotFound or ActionController::UnknownAction error.
131126

127+
== Manually notifying of error in a rescue block
128+
129+
If your controller action manually handles an error, the notifier will never be
130+
run. To manually notify of an error call notify_about_exception from within the
131+
rescue block
132+
133+
def index
134+
#risky operation here
135+
rescue StandardError => error
136+
#custom error handling here
137+
notify_about_exception(error)
138+
end
132139

133140
Copyright (c) 2005 Jamis Buck, released under the MIT license

0 commit comments

Comments
 (0)