Exception: Keycardai::OAuth::ResourceAccessError

Inherits:
Error
  • Object
show all
Defined in:
lib/keycardai/oauth/errors.rb

Overview

Raised by AccessContext#access when a token cannot be handed out. The error_type identifies the condition: global_error (a context-wide error is set), resource_error (the named resource's exchange failed), or missing_token (the resource was never granted). For missing_token, available_resources lists what was granted.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, resource:, error_type:, available_resources: [], error_details: nil) ⇒ ResourceAccessError

Returns a new instance of ResourceAccessError.



105
106
107
108
109
110
111
# File 'lib/keycardai/oauth/errors.rb', line 105

def initialize(message, resource:, error_type:, available_resources: [], error_details: nil)
  super(message)
  @resource = resource
  @error_type = error_type
  @available_resources = available_resources
  @error_details = error_details
end

Instance Attribute Details

#available_resourcesArray<String> (readonly)

Returns:

  • (Array<String>)


101
102
103
# File 'lib/keycardai/oauth/errors.rb', line 101

def available_resources
  @available_resources
end

#error_detailsObject? (readonly)

Returns the recorded upstream error, when one exists.

Returns:

  • (Object, nil)

    the recorded upstream error, when one exists



103
104
105
# File 'lib/keycardai/oauth/errors.rb', line 103

def error_details
  @error_details
end

#error_typeString (readonly)

Returns global_error | resource_error | missing_token.

Returns:

  • (String)

    global_error | resource_error | missing_token



99
100
101
# File 'lib/keycardai/oauth/errors.rb', line 99

def error_type
  @error_type
end

#resourceString (readonly)

Returns:

  • (String)


97
98
99
# File 'lib/keycardai/oauth/errors.rb', line 97

def resource
  @resource
end