Exception: AtlasRb::ForbiddenError

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

Overview

Note:

Scoped to the re-parent / linked-member write paths, the Compilation surface, and the container-create endpoints — 403s on other endpoints still surface as raw responses for the caller's own rescue layer, unchanged.

Raised when Atlas refuses a re-parent, linked-member, Compilation, or container-create request with an HTTP 403, whose envelope is { "error", "action", "subject" }. Lets callers distinguish "you may not do this" from a structural rejection (ReparentError / LinkedMemberError / CompilationError) or a not-found.

On a create the action is create_child and the subject is the parent container's class: the caller holds no edit rights on the container the new child would land in.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code: nil, action: nil, subject: nil) ⇒ ForbiddenError

Returns a new instance of ForbiddenError.

Parameters:

  • message (String)

    human-readable authorization-failure description.

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

    the envelope's error value.

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

    the forbidden action.

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

    the subject the action was forbidden on.



270
271
272
273
274
275
# File 'lib/atlas_rb/errors.rb', line 270

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

Instance Attribute Details

#actionString? (readonly)

Returns the action that was forbidden (e.g. "reparent").

Returns:

  • (String, nil)

    the action that was forbidden (e.g. "reparent").



261
262
263
# File 'lib/atlas_rb/errors.rb', line 261

def action
  @action
end

#codeString? (readonly)

Returns the envelope's error value.

Returns:

  • (String, nil)

    the envelope's error value.



258
259
260
# File 'lib/atlas_rb/errors.rb', line 258

def code
  @code
end

#subjectString? (readonly)

Returns the subject (resource) the action was forbidden on.

Returns:

  • (String, nil)

    the subject (resource) the action was forbidden on.



264
265
266
# File 'lib/atlas_rb/errors.rb', line 264

def subject
  @subject
end