Exception: Genius::Errors::TokenError

Inherits:
GeniusExceptionSuperClass show all
Defined in:
lib/genius/api/errors.rb

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 genius.com/signup_or_login and login, then you need to create new client via the link below: 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

Instance Method Summary collapse

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) ⇒ String (frozen)

Parameters:

  • msg (String (frozen)) (defaults to: "Invalid token. The access token provided is expired, revoked, malformed or invalid for " \ "other reasons.")

    Exception message.

  • exception_type (String (frozen)) (defaults to: "token_error")

    Exception type.



65
66
67
68
69
70
71
72
73
74
# File 'lib/genius/api/errors.rb', line 65

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_typeObject (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_nameObject (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

#msgObject (readonly)

Returns the value of attribute msg.



60
61
62
# File 'lib/genius/api/errors.rb', line 60

def msg
  @msg
end