Exception: AtlasRb::DerivativePermissionsError
- Defined in:
- lib/atlas_rb/errors.rb
Overview
Authorization failures surface as ForbiddenError (HTTP 403).
Raised when Atlas rejects a per-tier derivative-visibility policy
(PATCH /works/:id/derivative_permissions) with a 422 carrying a
machine-readable error discriminator — tier_exceeds_resource (a tier
more visible than its Work), tier_ordering_violation (visibility not
narrowing as resolution grows), or unknown_tier.
The derivative-permissions sibling of ReparentError / LinkedMemberError;
same shape, same rationale (the binding's ["work"] unwrap would otherwise
discard the envelope on the 422). Atlas rejects before persisting.
rescue AtlasRb::DerivativePermissionsError => e
flash.now[:alert] = t("derivative_permissions.errors.#{e.code}", default: e.message)
Instance Attribute Summary collapse
-
#code ⇒ String?
readonly
The machine-readable error code from the envelope, suitable for keying an i18n map.
-
#resource_id ⇒ String?
readonly
The rejected Work's ID, from the envelope.
Instance Method Summary collapse
-
#initialize(message, code: nil, resource_id: nil) ⇒ DerivativePermissionsError
constructor
A new instance of DerivativePermissionsError.
Constructor Details
#initialize(message, code: nil, resource_id: nil) ⇒ DerivativePermissionsError
Returns a new instance of DerivativePermissionsError.
197 198 199 200 201 |
# File 'lib/atlas_rb/errors.rb', line 197 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, suitable for keying an i18n map.
189 190 191 |
# File 'lib/atlas_rb/errors.rb', line 189 def code @code end |
#resource_id ⇒ String? (readonly)
Returns the rejected Work's ID, from the envelope.
192 193 194 |
# File 'lib/atlas_rb/errors.rb', line 192 def resource_id @resource_id end |