module SlackErrorNotifier

Constants

VERSION

Public Class Methods

check_configuration(block_given) click to toggle source
# File lib/slack_error_notifier.rb, line 38
def self.check_configuration(block_given)
  raise ConfigurationError::NoBlockGivenError unless block_given
  raise ConfigurationError::MissingConfiguration unless access_token && target_channel
end
configure_slack_client() click to toggle source
# File lib/slack_error_notifier.rb, line 26
def self.configure_slack_client
  @slack_configuration = SlackConfiguration.new
end
send_notification(error) click to toggle source
# File lib/slack_error_notifier.rb, line 34
def self.send_notification(error)
  SlackNotification.send(error)
end
slack_client() click to toggle source
# File lib/slack_error_notifier.rb, line 30
def self.slack_client
  @slack_configuration.slack_client
end
with_notifications() { || ... } click to toggle source
# File lib/slack_error_notifier.rb, line 17
def self.with_notifications
  check_configuration(block_given?)
  configure_slack_client
  yield
rescue => error
  puts "Encountered #{error}. Sending Notification to #{target_channel}."
  send_notification(error)
end