class ObjectFramework::FailureReporter
Reports one primary failure per ExecutionContext and secondary cleanup failures. Records exclude exception messages and input values.
Public Class Methods
Source
# File lib/object_framework/errors.rb, line 77 def initialize(sink: ->(record) {}, registry: ErrorRegistry.new) @sink, @registry = sink, registry end
sink receives immutable diagnostic hashes. Sink failures are suppressed so diagnostics cannot replace the original application failure.
Public Instance Methods
Source
# File lib/object_framework/errors.rb, line 83 def report(exception, context:, secondary: false) return if !secondary && !context.claim_failure # Messages and argument values are deliberately absent: they can contain secrets. record = { operation_id: context.operation_id, code: @registry.resolve(exception).code, exception: exception.class.name, cause: exception.cause&.class&.name, backtrace: exception.backtrace&.dup, duration: context.elapsed, transaction_state: context.transaction_state, secondary: } @sink.call(Values.detach(record)) rescue StandardError # Diagnostics must never replace the exception being reported. nil end
Sends operation ID, public code, exception/cause class names, backtrace, elapsed duration, transaction outcome, and the secondary flag to the sink.