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, delivery_pipeline, logger = nil, options = {}) ⇒ CaptureException
constructor
A new instance of CaptureException.
Constructor Details
#initialize(config, delivery_pipeline, logger = nil, options = {}) ⇒ CaptureException
Returns a new instance of CaptureException.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/chronos/application/capture_exception.rb', line 16 def initialize(config, delivery_pipeline, logger = nil, = {}) @config = config @delivery_pipeline = delivery_pipeline @logger = logger || Internal::SafeLogger.new(config.logger) @notice_builder = [:notice_builder] || Core::NoticeBuilder.new(config) @serializer = [:serializer] || Core::PayloadSerializer.new( config, nil, :max_payload_size => proc { @delivery_pipeline.max_payload_size } ) end |
Instance Method Details
#call(exception, context = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/chronos/application/capture_exception.rb', line 28 def call(exception, context = {}) return false unless capture_enabled? notice = build_notice(exception, context) return false unless @delivery_pipeline.capture_allowed?("exception", notice.fingerprint) @delivery_pipeline.enqueue(@serializer.call(notice)) rescue StandardError => error diagnose(error) false end |
#call_sync(exception, context = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chronos/application/capture_exception.rb', line 40 def call_sync(exception, context = {}) return false unless capture_enabled? notice = build_notice(exception, context) return false unless @delivery_pipeline.capture_allowed?("exception", notice.fingerprint) @delivery_pipeline.deliver_sync(@serializer.call(notice)) rescue StandardError => error diagnose(error) false end |