Class: Chronos::Application::CaptureException
- Inherits:
-
Object
- Object
- Chronos::Application::CaptureException
- Defined in:
- lib/chronos/application/capture_exception.rb
Overview
Orchestrates exception normalization, serialization, queueing, and delivery.
Instance Method Summary collapse
- #call(exception, context = {}) ⇒ Object
- #call_sync(exception, context = {}) ⇒ Object
-
#initialize(config, worker_pool, transport, logger = nil, options = {}) ⇒ CaptureException
constructor
A new instance of CaptureException.
Constructor Details
#initialize(config, worker_pool, transport, logger = nil, options = {}) ⇒ CaptureException
Returns a new instance of CaptureException.
16 17 18 19 20 21 22 23 |
# File 'lib/chronos/application/capture_exception.rb', line 16 def initialize(config, worker_pool, transport, logger = nil, = {}) @config = config @worker_pool = worker_pool @transport = transport @logger = logger || Internal::SafeLogger.new(config.logger) @notice_builder = [:notice_builder] || Core::NoticeBuilder.new(config) @serializer = [:serializer] || Core::PayloadSerializer.new(config) end |
Instance Method Details
#call(exception, context = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/chronos/application/capture_exception.rb', line 25 def call(exception, context = {}) return false unless capture_enabled? event = build_event(exception, context) @worker_pool.enqueue(event) rescue StandardError => error diagnose(error) false end |
#call_sync(exception, context = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/chronos/application/capture_exception.rb', line 35 def call_sync(exception, context = {}) return false unless capture_enabled? event = build_event(exception, context) @transport.send_event(event).success? rescue StandardError => error diagnose(error) false end |