Ruby And Exception Notification
By Adrian Gomez
The problem
gem install 'notify_me'
Existent solutions
gem install 'exception_notification'
[toggle title_open=”Close Me” title_closed=”Exception Notification Dependencies” hide=”yes” border=”yes” style=”default” excerpt_length=”0″ read_more_text=”Show dependencies” read_less_text=”Read Less” include_excerpt_html=”no”]
i18n
multi_json
activesupport
builder
activemodel
erubis
journey
rack
rack-cache
rack-test
hike
tilt
sprockets
actionpack
mime-types
polyglot
treetop
mail
actionmailer
eventmachine
multipart-post
faraday
faraday_middleware
hashie
json
http_parser.rb
simple_oauth
twitter-stream
tinder
[/toggle]
Path Taken
gem install 'rusen'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
require 'rusen' Rusen.settings.email_prefix = '[ERROR] ' Rusen.settings.sender_address = 'some_email@example.com' Rusen.settings.exception_recipients = %w(dev_team@example.com test_team@example.com) Rusen.settings.smtp_settings = { :address => 'smtp.gmail.com', :port => 587, :domain => 'example.org', :authentication => :plain, :user_name => 'dev_team@moove-it.com', :password => 'xxxxxxx', :enable_starttls_auto => true } begin method.call rescue Exception => exception Rusen.notify(exception) end |
Conclusion
In the end it was an enjoyable experience in witch i learned a lot of things and the end result is something simple yet flexible that we can actually use in our production environment.