Class: NatsWork::ErrorNotifiers::WebhookNotifier
- Inherits:
-
Object
- Object
- NatsWork::ErrorNotifiers::WebhookNotifier
- Defined in:
- lib/natswork/error_tracker.rb
Instance Method Summary collapse
- #call(error_info) ⇒ Object
-
#initialize(webhook_url, options = {}) ⇒ WebhookNotifier
constructor
A new instance of WebhookNotifier.
Constructor Details
#initialize(webhook_url, options = {}) ⇒ WebhookNotifier
306 307 308 309 310 |
# File 'lib/natswork/error_tracker.rb', line 306 def initialize(webhook_url, = {}) @webhook_url = webhook_url @http_timeout = .fetch(:timeout, 5) @retry_count = .fetch(:retries, 2) end |
Instance Method Details
#call(error_info) ⇒ Object
312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/natswork/error_tracker.rb', line 312 def call(error_info) payload = { error: { type: error_info[:type], message: error_info[:message], fingerprint: error_info[:fingerprint], timestamp: error_info[:timestamp].iso8601, context: error_info[:context] } } send_webhook(payload) end |