-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46d7b7e
commit 4b99a97
Showing
3 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
Add the gem: | ||
|
||
```bash | ||
bundle add email_error_reporter && bundle install | ||
bundle add email_error_reporter | ||
``` | ||
|
||
and configure the email addresses that should receive an email in the case of an exception: | ||
|
@@ -37,6 +37,14 @@ Set a custom from address. | |
config.email_error_reporter.from = "[email protected]" | ||
``` | ||
|
||
Disables the email reports for specific environments. Mails are enabled by default on all envs. | ||
|
||
```ruby | ||
# e.g. in development.rb | ||
# default: true | ||
config.email_error_reporter.enabled = false | ||
``` | ||
|
||
## Test your setup | ||
|
||
You can use the built-in rake task `rake email_error_reporter:check` to check if everything works correctly in your setup. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,12 @@ class Engine < ::Rails::Engine | |
config.email_error_reporter = ActiveSupport::OrderedOptions.new | ||
config.email_error_reporter.to = [] | ||
config.email_error_reporter.from = "[email protected]" | ||
config.email_error_reporter.enabled = true | ||
|
||
initializer "email_error_reporter.error_subscribe" do | ||
Rails.error.subscribe(Subscriber.new) | ||
initializer "email_error_reporter.error_subscribe" do |app| | ||
if app.config.email_error_reporter.enabled | ||
Rails.error.subscribe(Subscriber.new) | ||
end | ||
end | ||
|
||
# ActiveJob cannot (de)-serialize exceptions by default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters