Sha256: 4a28ba23152b97b311f1bd8d7334106769e3acea9f3264b4def145d04713dab8

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 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(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(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.4.0 lib/exception_notifier/base_notifier.rb