Exception: Reeve::AuditWriteError

Inherits:
Error
  • Object
show all
Defined in:
lib/reeve/errors.rb

Overview

Raised when the ledger write fails and audit_failure_mode is :fail (FR-012).

It carries a rule like any other denial, because the failure is not recorded anywhere else: the ledger is the thing that failed, so there is no row to read afterwards. The exception is the only artifact, and a host matching on rules can match on this one.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invocation_id:, cause: nil, during: nil) ⇒ AuditWriteError

Returns a new instance of AuditWriteError.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/reeve/errors.rb', line 75

def initialize(invocation_id:, cause: nil, during: nil)
  @invocation_id  = invocation_id&.to_s
  @original_error = cause
  @during         = during
  @rule           = Decision::AUDIT_WRITE_FAILED
  message = "reeve could not record invocation #{@invocation_id}"
  message = "#{message}: #{cause.message}" if cause
  if during
    message = "#{message} (while the invocation was already failing with " \
              "#{during.class}: #{during.message})"
  end
  super(message)
end

Instance Attribute Details

#duringObject (readonly)

during is whatever the invocation was already raising when the ledger write failed — usually a DeniedError, sometimes the tool's own exception. It is carried rather than discarded: the audit failure must win, because a call that cannot be recorded is a failed call, but the developer still needs to see what the call was doing at the time.



73
74
75
# File 'lib/reeve/errors.rb', line 73

def during
  @during
end

#invocation_idObject (readonly)

Returns the value of attribute invocation_id.



66
67
68
# File 'lib/reeve/errors.rb', line 66

def invocation_id
  @invocation_id
end

#original_errorObject (readonly)

Returns the value of attribute original_error.



66
67
68
# File 'lib/reeve/errors.rb', line 66

def original_error
  @original_error
end

#ruleObject (readonly)

Returns the value of attribute rule.



66
67
68
# File 'lib/reeve/errors.rb', line 66

def rule
  @rule
end