Sha256: ac3199a4b0b64d1a00cc5c1112214617d568d407ae7570ce382b415ff3930ff7

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'net/http'
require 'net/https'
require 'rubygems'

begin
  require 'active_support'
  require 'active_support/core_ext'
rescue LoadError
  require 'activesupport'
  require 'activesupport/core_ext'
end

require "errplane/version"
require "errplane/black_box"
require "errplane/configuration"
require "errplane/transmitter"
require "errplane/rack"

require "errplane/railtie" #if defined?(Rails)

module Errplane
  API_HOST = "api.errplane.com"

  class << self
    attr_writer :configuration
    attr_accessor :transmitter

    def configure(silent = false)
      yield(configuration)
      self.transmitter = Transmitter.new(configuration)
    end

    def configuration
      @configuration ||= Configuration.new
    end

    def transmit_to_api(exception)
      transmitter.relay(assemble_black_box_for(exception))
    end

    private
    def assemble_black_box_for(exception, options = {})
      exception = unwrap_exception(exception)
      black_box = BlackBox.new(exception: exception)
    end

    def unwrap_exception(exception)
      if exception.respond_to?(:original_exception)
        exception.original_exception
      elsif exception.respond_to?(:continued_exception)
        exception.continued_exception
      else
        exception
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
errplane-0.0.1 lib/errplane.rb