Exception: Safire::Errors::TokenError

Inherits:
OAuthError show all
Includes:
ReceivesFields
Defined in:
lib/safire/errors.rb

Overview

Raised for token exchange or refresh failures.

Two usage paths:

  • HTTP failure: provide status, error_code, and/or error_description

  • Structural failure (missing access_token): provide received_fields

Instance Attribute Summary collapse

Attributes inherited from OAuthError

#error_code, #error_description, #status

Method Summary

Methods included from ReceivesFields

included, #initialize

Methods inherited from OAuthError

#initialize

Instance Attribute Details

#received_fieldsArray<String>? (readonly)

Returns field names present in an invalid token response (no values logged).

Returns:

  • (Array<String>, nil)

    field names present in an invalid token response (no values logged)



180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/safire/errors.rb', line 180

class TokenError < OAuthError
  include ReceivesFields

  private

  def operation_label = 'Token request failed'

  def build_message
    return super unless @received_fields&.any?

    "Missing access token in response; received fields: #{@received_fields.join(', ')}"
  end
end