Exception: OAuth2::Error
- Inherits:
-
StandardError
- Object
- StandardError
- OAuth2::Error
- Defined in:
- lib/oauth2/error.rb
Overview
Represents an OAuth2 error condition.
Wraps details from an OAuth2::Response or Hash payload returned by an authorization server, exposing error code and description per RFC 6749.
Instance Attribute Summary collapse
- #body ⇒ OAuth2::Response, ... readonly
- #code ⇒ OAuth2::Response, ... readonly
- #description ⇒ OAuth2::Response, ... readonly
- #response ⇒ OAuth2::Response, ... readonly
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
Create a new OAuth2::Error.
Constructor Details
#initialize(response) ⇒ Error
Create a new OAuth2::Error
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/oauth2/error.rb', line 18 def initialize(response) @response = response if response.respond_to?(:parsed) if response.parsed.is_a?(Hash) @code = response.parsed["error"] @description = response.parsed["error_description"] end elsif response.is_a?(Hash) @code = response["error"] @description = response["error_description"] end @body = if response.respond_to?(:body) response.body else @response end = parse_error_description(@code, @description) super((@body, )) end |
Instance Attribute Details
#body ⇒ OAuth2::Response, ... (readonly)
13 14 15 |
# File 'lib/oauth2/error.rb', line 13 def body @body end |
#code ⇒ OAuth2::Response, ... (readonly)
13 14 15 |
# File 'lib/oauth2/error.rb', line 13 def code @code end |
#description ⇒ OAuth2::Response, ... (readonly)
13 14 15 |
# File 'lib/oauth2/error.rb', line 13 def description @description end |
#response ⇒ OAuth2::Response, ... (readonly)
13 14 15 |
# File 'lib/oauth2/error.rb', line 13 def response @response end |