Module: Safire::Errors

Defined in:
lib/safire/errors.rb

Overview

Namespace for all Safire error classes.

Every Safire error inherits from Error so consumers can rescue all Safire errors with a single +rescue Safire::Errors::Error+. Each subclass exposes typed, domain-specific attributes and builds its own human-readable message.

Examples:

Rescuing a specific error

begin
  tokens = client.request_access_token(code: code, code_verifier: verifier)
rescue Safire::Errors::TokenError => e
  puts e.message        # "Token request failed — HTTP 401 — invalid_grant — Code expired"
  puts e.status         # 401
  puts e.error_code     # "invalid_grant"
rescue Safire::Errors::Error => e
  puts e.message        # catch-all for any other Safire error
end

Defined Under Namespace

Classes: AuthError, CertificateError, ConfigurationError, DiscoveryError, Error, NetworkError, TokenError, ValidationError