Class: ExceptionsToSlack::Notifier
- Inherits:
-
Object
- Object
- ExceptionsToSlack::Notifier
- Defined in:
- lib/exceptions_to_slack/notifier.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Notifier
constructor
A new instance of Notifier.
Constructor Details
#initialize(app, options = {}) ⇒ Notifier
Returns a new instance of Notifier.
5 6 7 8 9 10 11 12 |
# File 'lib/exceptions_to_slack/notifier.rb', line 5 def initialize(app, = {}) @app = app @notifier = Slack::Notifier.new(url()) @notifier.channel = [:channel] || raise("Channel is required") @notifier.username = [:user] || "Notifier" @ignore = [:ignore] @additional_parameters = [:additional_parameters] || {} end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/exceptions_to_slack/notifier.rb', line 14 def call(env) @app.call(env) rescue Exception => exception send_to_slack(exception) unless @ignore && @ignore.match(exception.to_s) raise exception end |