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
Constructor Details
#initialize(msg = "authentication required", state: nil, suggested_flow: nil, reason: nil) ⇒ AuthRequiredError
Returns a new instance of AuthRequiredError.
40 41 42 43 44 45 |
# File 'lib/browserctl/errors.rb', line 40 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.
38 39 40 |
# File 'lib/browserctl/errors.rb', line 38 def reason @reason end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
38 39 40 |
# File 'lib/browserctl/errors.rb', line 38 def state @state end |
#suggested_flow ⇒ Object (readonly)
Returns the value of attribute suggested_flow.
38 39 40 |
# File 'lib/browserctl/errors.rb', line 38 def suggested_flow @suggested_flow end |
Class Method Details
.default_code ⇒ Object
34 |
# File 'lib/browserctl/errors.rb', line 34 def self.default_code = "AUTH_REQUIRED" |
Instance Method Details
#to_response ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/browserctl/errors.rb', line 47 def to_response { error: , code: self.class.default_code, state: state, suggested_flow: suggested_flow, reason: reason }.compact end |