Exception: Parse::Agent::AccessDenied
- Inherits:
-
AgentError
- Object
- StandardError
- AgentError
- Parse::Agent::AccessDenied
- Defined in:
- lib/parse/agent/errors.rb
Overview
Raised by agent tools when a request targets a Parse class that has been marked ‘agent_hidden` (see Parse::Agent::MetadataDSL). The rescue path in Parse::Agent#execute translates this to a `:access_denied` error_response without leaking the class name to the wire beyond the sanitized message the caller used.
Instance Attribute Summary collapse
-
#allowed_fields ⇒ Object
readonly
Returns the value of attribute allowed_fields.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#denied_field ⇒ Object
readonly
Returns the value of attribute denied_field.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#suggested_rewrite ⇒ Object
readonly
Returns the value of attribute suggested_rewrite.
Instance Method Summary collapse
-
#initialize(class_name = nil, message = nil, kind: nil, denied_field: nil, allowed_fields: nil, suggested_rewrite: nil) ⇒ AccessDenied
constructor
A new instance of AccessDenied.
-
#to_details ⇒ Object
Structured details for the error_response payload.
Constructor Details
#initialize(class_name = nil, message = nil, kind: nil, denied_field: nil, allowed_fields: nil, suggested_rewrite: nil) ⇒ AccessDenied
Returns a new instance of AccessDenied.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/parse/agent/errors.rb', line 68 def initialize(class_name = nil, = nil, kind: nil, denied_field: nil, allowed_fields: nil, suggested_rewrite: nil) @class_name = class_name.to_s @kind = kind @denied_field = denied_field @allowed_fields = allowed_fields&.map(&:to_s) @suggested_rewrite = suggested_rewrite super( || "Class '#{@class_name}' is not accessible to this agent") end |
Instance Attribute Details
#allowed_fields ⇒ Object (readonly)
Returns the value of attribute allowed_fields.
41 42 43 |
# File 'lib/parse/agent/errors.rb', line 41 def allowed_fields @allowed_fields end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
41 42 43 |
# File 'lib/parse/agent/errors.rb', line 41 def class_name @class_name end |
#denied_field ⇒ Object (readonly)
Returns the value of attribute denied_field.
41 42 43 |
# File 'lib/parse/agent/errors.rb', line 41 def denied_field @denied_field end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
41 42 43 |
# File 'lib/parse/agent/errors.rb', line 41 def kind @kind end |
#suggested_rewrite ⇒ Object (readonly)
Returns the value of attribute suggested_rewrite.
41 42 43 |
# File 'lib/parse/agent/errors.rb', line 41 def suggested_rewrite @suggested_rewrite end |
Instance Method Details
#to_details ⇒ Object
Structured details for the error_response payload. Returns a Hash with only the populated keys so the wire envelope doesn’t carry unused nil fields.
82 83 84 85 86 87 88 89 |
# File 'lib/parse/agent/errors.rb', line 82 def to_details { kind: kind, denied_field: denied_field, allowed_fields: allowed_fields, suggested_rewrite: suggested_rewrite, }.compact end |