Exception: Browserctl::AuthRequiredError
- Defined in:
- lib/browserctl/errors.rb
Overview
Raised when the daemon detects that the current page needs authentication —the canonical signal that a workflow’s ‘load_state` should rotate the bound flow. Carries the bundle name (when a state load was in progress) and a suggested flow (from the bundle manifest) so callers can recover without additional lookups. The CLI maps this code to exit status 7.
Constant Summary collapse
- AUTH_REQUIRED_EXIT_CODE =
7
Instance Attribute Summary collapse
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#suggested_flow ⇒ Object
readonly
Returns the value of attribute suggested_flow.
Attributes inherited from Error
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg = "authentication required", state: nil, suggested_flow: nil, reason: nil) ⇒ AuthRequiredError
constructor
A new instance of AuthRequiredError.
- #to_response ⇒ Object
Methods inherited from Error
Constructor Details
#initialize(msg = "authentication required", state: nil, suggested_flow: nil, reason: nil) ⇒ AuthRequiredError
Returns a new instance of AuthRequiredError.
62 63 64 65 66 67 |
# File 'lib/browserctl/errors.rb', line 62 def initialize(msg = "authentication required", state: nil, suggested_flow: nil, reason: nil) super(msg) @state = state @suggested_flow = suggested_flow @reason = reason end |
Instance Attribute Details
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
60 61 62 |
# File 'lib/browserctl/errors.rb', line 60 def reason @reason end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
60 61 62 |
# File 'lib/browserctl/errors.rb', line 60 def state @state end |
#suggested_flow ⇒ Object (readonly)
Returns the value of attribute suggested_flow.
60 61 62 |
# File 'lib/browserctl/errors.rb', line 60 def suggested_flow @suggested_flow end |
Class Method Details
.default_code ⇒ Object
56 |
# File 'lib/browserctl/errors.rb', line 56 def self.default_code = Codes::AUTH_REQUIRED |
Instance Method Details
#to_response ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/browserctl/errors.rb', line 69 def to_response { error: , code: self.class.default_code, state: state, suggested_flow: suggested_flow, reason: reason, context: { state: state, suggested_flow: suggested_flow, reason: reason }.compact, suggested_action: SuggestedActions.for(self.class.default_code) }.compact end |