Sha256: 92e1824aff8d3eb37d0fd8578a40b3f695e5a949213ced6736e853c9327c7615

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

module ExceptionNotifier
  class BaseNotifier
    attr_accessor :base_options

    def initialize(options={})
      @base_options = options
    end

    def send_notice(exception, options, message, message_opts=nil)
      _pre_callback(exception, options, message, message_opts)
      result = yield(message, message_opts)
      _post_callback(exception, options, message, message_opts)
      result
    end

    def _pre_callback(exception, options, message, message_opts)
      @base_options[:pre_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call)
    end

    def _post_callback(exception, options, message, message_opts)
      @base_options[:post_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_notification-4.1.3 lib/exception_notifier/base_notifier.rb