Exception: Basecamp::Oauth::DiscoverySelectionError

Inherits:
OauthError
  • Object
show all
Defined in:
lib/basecamp/oauth/discovery_selection_error.rb

Overview

A hard resource-first selection/validation failure. Raised — never returned as a fallback — so no consumer can convert it into a Launchpad request.

The reason is one of: ambiguous_issuers, expected_issuer_unavailable, invalid_issuer_origin, as_fetch_failed, issuer_mismatch, capability_unavailable.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, message, http_status: nil) ⇒ DiscoverySelectionError

Returns a new instance of DiscoverySelectionError.

Parameters:

  • reason (String)

    the hard-failure classification

  • message (String)

    human-readable description

  • http_status (Integer, nil) (defaults to: nil)

    HTTP status code, if applicable



19
20
21
22
23
24
25
26
27
# File 'lib/basecamp/oauth/discovery_selection_error.rb', line 19

def initialize(reason, message, http_status: nil)
  # Only capability_unavailable is consumer/usage-shaped (validation). Every
  # other reason — including expected_issuer_unavailable — is an AS metadata
  # fault surfaced as api_error, matching the other four SDKs (an issuer the
  # resource does not advertise is a metadata fault, not a caller-usage one).
  type = reason == "capability_unavailable" ? "validation" : "api_error"
  super(type, message, http_status: http_status)
  @reason = reason
end

Instance Attribute Details

#reasonString

the hard-failure classification

Returns:

  • (String)

    the current value of reason



13
14
15
# File 'lib/basecamp/oauth/discovery_selection_error.rb', line 13

def reason
  @reason
end