class Bugno::Handler

Attributes

env[R]
event[R]
exception[R]
job[R]
reporter[R]

Public Class Methods

call(options = {}) click to toggle source
# File lib/bugno/handler.rb, line 16
def self.call(options = {})
  self.new(options).handle_exception
end
new(options = {}) click to toggle source
# File lib/bugno/handler.rb, line 10
def initialize(options = {})
  @exception = options[:exception]
  @event = Event.new(exception: options[:exception], env: options[:env], job: options[:job])
  @reporter = Reporter.new
end

Public Instance Methods

handle_exception() click to toggle source
# File lib/bugno/handler.rb, line 20
def handle_exception
  return if excluded_exception? || !usage_environment?

  @reporter.request.body = @event.data.to_json
  Bugno.configuration.send_in_background ? Thread.new { @reporter.send } : @reporter.send
end

Private Instance Methods

excluded_exception?() click to toggle source
# File lib/bugno/handler.rb, line 29
def excluded_exception?
  Bugno.configuration.exclude_rails_exceptions && \
    Bugno.configuration.excluded_exceptions.include?(@exception.class.inspect)
end
usage_environment?() click to toggle source
# File lib/bugno/handler.rb, line 34
def usage_environment?
  Bugno.configuration.usage_environments.include?(Bugno.configuration.environment)
end