Class: ToadNotifier
- Inherits:
-
Object
- Object
- ToadNotifier
- Defined in:
- lib/toad_notifier.rb,
lib/toad_notifier/version.rb
Constant Summary collapse
- VERSION =
0.2
Class Method Summary collapse
- .config ⇒ Object
- .config=(config) ⇒ Object
- .notify!(exception, options = {}) ⇒ Object
-
.notify_with_message!(exception, message, options = {}) ⇒ Object
Logs a exception with a custom error message, preserving the original exception class and backtrace.
Class Method Details
.config ⇒ Object
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, ={}) Toadhopper.new(@@config[:api_key]).post!(exception, ) 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.(exception, , = {}) custom_exception = exception.class.new custom_exception.set_backtrace exception.backtrace Toadhopper.new(@@config[:api_key]).post!(custom_exception, ) end |