Exception: Kotoshu::IntegrityError
- Defined in:
- lib/kotoshu/core/exceptions.rb
Overview
Error raised when a downloaded resource fails integrity verification (SHA-256 mismatch against manifest, truncated content, etc.).
The downloaded bytes are never trusted until verified against a known manifest entry. Mismatch raises this error with both hashes so the caller can surface them in audit logs and CI output.
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(resource_id, expected:, actual:, url: nil) ⇒ IntegrityError
constructor
A new instance of IntegrityError.
Constructor Details
#initialize(resource_id, expected:, actual:, url: nil) ⇒ IntegrityError
Returns a new instance of IntegrityError.
152 153 154 155 156 157 158 159 160 161 |
# File 'lib/kotoshu/core/exceptions.rb', line 152 def initialize(resource_id, expected:, actual:, url: nil) @resource_id = resource_id @expected = expected @actual = actual @url = url msg = +"Integrity verification failed for #{resource_id}: " msg << "expected sha256=#{expected}, got sha256=#{actual}" msg << " (url: #{url})" if url super(msg) end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
163 164 165 |
# File 'lib/kotoshu/core/exceptions.rb', line 163 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
163 164 165 |
# File 'lib/kotoshu/core/exceptions.rb', line 163 def expected @expected end |
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
163 164 165 |
# File 'lib/kotoshu/core/exceptions.rb', line 163 def resource_id @resource_id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
163 164 165 |
# File 'lib/kotoshu/core/exceptions.rb', line 163 def url @url end |