Exception: Conductor::AuthorizationError
- Inherits:
-
ApiError
- Object
- StandardError
- ConductorError
- ApiError
- Conductor::AuthorizationError
- Defined in:
- lib/conductor/exceptions.rb
Overview
Authorization error (401/403 with special token handling)
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
Attributes inherited from ApiError
#body, #code, #headers, #reason, #status
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, body: nil, headers: nil) ⇒ AuthorizationError
constructor
A new instance of AuthorizationError.
- #invalid_token? ⇒ Boolean
- #token_expired? ⇒ Boolean
Methods inherited from ApiError
Constructor Details
#initialize(message = nil, status: nil, body: nil, headers: nil) ⇒ AuthorizationError
Returns a new instance of AuthorizationError.
40 41 42 43 |
# File 'lib/conductor/exceptions.rb', line 40 def initialize( = nil, status: nil, body: nil, headers: nil) @error_code = parse_error_code(body) super(, status: status, body: body, headers: headers) end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
38 39 40 |
# File 'lib/conductor/exceptions.rb', line 38 def error_code @error_code end |
Instance Method Details
#invalid_token? ⇒ Boolean
49 50 51 |
# File 'lib/conductor/exceptions.rb', line 49 def invalid_token? @error_code == 'INVALID_TOKEN' end |
#token_expired? ⇒ Boolean
45 46 47 |
# File 'lib/conductor/exceptions.rb', line 45 def token_expired? @error_code == 'EXPIRED_TOKEN' end |