lib/sapience/appender/sentry.rb in sapience-0.1.9 vs lib/sapience/appender/sentry.rb in sapience-0.1.10

- old
+ new

@@ -41,19 +41,20 @@ def initialize(options = {}, &block) validate_options!(options) options[:level] ||= :error Raven.configure do |config| - config.dsn = options.delete(:dsn) + config.dsn = options.delete(:dsn) + config.tags = { environment: Sapience.environment } end + super(options, &block) end def validate_options!(options = {}) fail ArgumentError, "Options should be a Hash" unless options.is_a?(Hash) - fail ArgumentError, "Options need to have the key :dsn" unless options.key?(:dsn) - dsn_valid = options[:dsn] =~ URI::DEFAULT_PARSER.regexp[:ABS_URI] - fail ArgumentError, "The :dsn key is not a valid URI" unless dsn_valid + dsn_valid = options[:dsn].to_s =~ URI::DEFAULT_PARSER.regexp[:ABS_URI] + fail ArgumentError, "The :dsn key (#{options[:dsn]}) is not a valid URI" unless dsn_valid end # Send an error notification to sentry def log(log) return false unless should_log?(log)