Class: ToadNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/toad_notifier.rb,
lib/toad_notifier/version.rb

Constant Summary collapse

VERSION =
0.2

Class Method Summary collapse

Class Method Details

.configObject



22
23
24
# File 'lib/toad_notifier.rb', line 22

def self.config
  @@config
end

.config=(config) ⇒ Object



18
19
20
# File 'lib/toad_notifier.rb', line 18

def self.config=(config)
  @@config = config.with_indifferent_access
end

.notify!(exception, options = {}) ⇒ Object



6
7
8
# File 'lib/toad_notifier.rb', line 6

def self.notify!(exception, options={})
  Toadhopper.new(@@config[:api_key]).post!(exception, options)
end

.notify_with_message!(exception, message, options = {}) ⇒ Object

Logs a exception with a custom error message, preserving the original exception class and backtrace



12
13
14
15
16
# File 'lib/toad_notifier.rb', line 12

def self.notify_with_message!(exception, message, options = {})
  custom_exception = exception.class.new message
  custom_exception.set_backtrace exception.backtrace
  Toadhopper.new(@@config[:api_key]).post!(custom_exception, options)
end