Sha256: 06678cdf500077c728d2dad9750d5cb97afdd01e6d5b113327e47b82c1d51164
Contents?: true
Size: 1.75 KB
Versions: 3
Compression:
Stored size: 1.75 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::Railtie require "errplane/sinatra" if defined? Sinatra::Request module Errplane 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(e, env) begin ::Rails.logger.info("\nTransmitter: #{transmitter.inspect}") ::Rails.logger.info("\nBlack Box: #{assemble_black_box_for(e).inspect}") ::Rails.logger.info("\nIgnorable Exception? #{ignorable_exception?(e)}") transmitter.relay(assemble_black_box_for(e)) unless ignorable_exception?(e) rescue configuration.logger.info("[Errplane] Something went terribly wrong. Exception failed to take off.") end end def ignorable_exception?(e) configuration.ignore_current_environment? || configuration.ignored_exceptions.include?(e.class.to_s) end private def assemble_black_box_for(e, options = {}) exception = unwrap_exception(e) black_box = BlackBox.new(exception: exception) end def unwrap_exception(e) if e.respond_to?(:original_exception) e.original_exception elsif e.respond_to?(:continued_exception) e.continued_exception else e end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
errplane-0.0.6 | lib/errplane.rb |
errplane-0.0.5 | lib/errplane.rb |
errplane-0.0.4 | lib/errplane.rb |