Exception: AtlasRb::CompilationError
- Defined in:
- lib/atlas_rb/errors.rb
Overview
Authorization failures surface as ForbiddenError (HTTP 403).
Raised when Atlas rejects a Compilation (Set) write with a 422
carrying a machine-readable error discriminator — a blank title on
create/update (invalid_record), or a membership add whose noid does
not resolve to the expected type (a Community where a Collection is
required, an unknown id, a Collection where a Work is required).
The Compilation sibling of LinkedMemberError; same shape, same
rationale (the binding's ["compilation"] unwrap would otherwise
discard the envelope on a non-2xx).
rescue AtlasRb::CompilationError => e flash.now[:alert] = e.message
Instance Attribute Summary collapse
-
#code ⇒ String?
readonly
The machine-readable error code from the envelope (currently
"invalid_record"). -
#resource_id ⇒ String?
readonly
The rejected resource's ID, from the envelope (may be nil — validation envelopes don't always carry one).
Instance Method Summary collapse
-
#initialize(message, code: nil, resource_id: nil) ⇒ CompilationError
constructor
A new instance of CompilationError.
Constructor Details
#initialize(message, code: nil, resource_id: nil) ⇒ CompilationError
Returns a new instance of CompilationError.
130 131 132 133 134 |
# File 'lib/atlas_rb/errors.rb', line 130 def initialize(, code: nil, resource_id: nil) super() @code = code @resource_id = resource_id end |
Instance Attribute Details
#code ⇒ String? (readonly)
Returns the machine-readable error code from the
envelope (currently "invalid_record").
121 122 123 |
# File 'lib/atlas_rb/errors.rb', line 121 def code @code end |
#resource_id ⇒ String? (readonly)
Returns the rejected resource's ID, from the envelope (may be nil — validation envelopes don't always carry one).
125 126 127 |
# File 'lib/atlas_rb/errors.rb', line 125 def resource_id @resource_id end |