Exception: AtlasRb::FixityMismatchError

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

Overview

Note:

Authorization failures surface as ForbiddenError (HTTP 403).

Raised when Atlas rejects a binary upload's verify-on-ingest check with a 422 carrying a fixity discriminator — fixity_mismatch (the uploaded bytes don't match the supplied expected_digest) or unsupported_digest_algorithm (a malformed/unknown expected_digest). Fires on POST /files, PATCH /files/:id, and PATCH /file_sets/:id.

The upload sibling of ReparentError / LinkedMemberError; same shape, same rationale — without it the ["blob"] / ["file_set"] unwrap would return nil on the 422 and discard the signal a migration needs to tell a corrupted transfer from a clean one. Atlas rejects before persisting, so nothing is left behind to clean up.

rescue AtlasRb::FixityMismatchError => e # e.code == "fixity_mismatch": re-fetch the source, retry, or quarantine

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code: nil, resource_id: nil) ⇒ FixityMismatchError

Returns a new instance of FixityMismatchError.

Parameters:

  • message (String)

    human-readable rejection description.

  • code (String, nil) (defaults to: nil)

    the envelope's error discriminator.

  • resource_id (String, nil) (defaults to: nil)

    the rejected resource's ID.



165
166
167
168
169
# File 'lib/atlas_rb/errors.rb', line 165

def initialize(message, code: nil, resource_id: nil)
  super(message)
  @code = code
  @resource_id = resource_id
end

Instance Attribute Details

#codeString? (readonly)

Returns the machine-readable error code from the envelope ("fixity_mismatch" or "unsupported_digest_algorithm").

Returns:

  • (String, nil)

    the machine-readable error code from the envelope ("fixity_mismatch" or "unsupported_digest_algorithm").



156
157
158
# File 'lib/atlas_rb/errors.rb', line 156

def code
  @code
end

#resource_idString? (readonly)

Returns the rejected resource's ID, from the envelope (the FileSet on the attach path; may be nil on POST /files).

Returns:

  • (String, nil)

    the rejected resource's ID, from the envelope (the FileSet on the attach path; may be nil on POST /files).



160
161
162
# File 'lib/atlas_rb/errors.rb', line 160

def resource_id
  @resource_id
end