Exception: Genius::Errors::TokenError
- Inherits:
-
GeniusExceptionSuperClass
- Object
- StandardError
- GeniusExceptionSuperClass
- Genius::Errors::TokenError
- Defined in:
- lib/genius/api/errors.rb,
sig/lib/genius/api/errors.rbs
Overview
A TokenError object provides handling error during token validation.
It throws error when token is invalid - expired, revoked or something
else. To generate new token you should go to
https://genius.com/signup_or_login and login, then you need to create
new client via the link below: https://genius.com/api-clients and
generate new access token. Fields to create new api client can
be filled in as you like - there is no restrictions and standards.
Instance Attribute Summary collapse
-
#exception_type ⇒ String
readonly
Returns the value of attribute exception_type.
-
#method_name ⇒ String?
readonly
Returns the value of attribute method_name.
-
#msg ⇒ String
readonly
Returns the value of attribute msg.
Instance Method Summary collapse
-
#initialize(msg: 'Invalid token. The access token provided is expired, revoked, malformed or invalid for ' \ 'other reasons.', exception_type: 'token_error', method_name: nil) ⇒ TokenError
constructor
Initializes a token validation error with optional method name hint.
Constructor Details
#initialize(msg: 'Invalid token. The access token provided is expired, revoked, malformed or invalid for ' \ 'other reasons.', exception_type: 'token_error', method_name: nil) ⇒ TokenError
Initializes a token validation error with optional method name hint.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/genius/api/errors.rb', line 68 def initialize(msg: 'Invalid token. The access token provided is expired, revoked, malformed or invalid for ' \ 'other reasons.', exception_type: 'token_error', method_name: nil) @msg = if method_name.nil? msg else "#{msg} or type #{method_name}(token: \"YOUR_TOKEN\")" end @exception_type = exception_type super(msg) end |
Instance Attribute Details
#exception_type ⇒ String (readonly)
Returns the value of attribute exception_type.
60 61 62 |
# File 'lib/genius/api/errors.rb', line 60 def exception_type @exception_type end |
#method_name ⇒ String? (readonly)
Returns the value of attribute method_name.
60 61 62 |
# File 'lib/genius/api/errors.rb', line 60 def method_name @method_name end |
#msg ⇒ String (readonly)
Returns the value of attribute msg.
60 61 62 |
# File 'lib/genius/api/errors.rb', line 60 def msg @msg end |