Lightning.Credentials.OauthValidation.Error (Lightning v2.13.5)

View Source

Represents OAuth-related errors with structured error information.

This module provides a standardized way to handle and categorize OAuth errors that can occur during authentication flows, token validation, and scope verification. Each error includes a type for programmatic handling, a human-readable message, and optional details for additional context.

Examples

iex> Error.new(:missing_scopes, "Required scopes not granted")
%Error{type: :missing_scopes, message: "Required scopes not granted", details: nil}

iex> Error.new(:missing_refresh_token, "No refresh token", %{existing_token_available: true})
%Error{type: :missing_refresh_token, message: "No refresh token", details: %{existing_token_available: true}}

Summary

Types

error_type()

@type error_type() ::
  :missing_scopes
  | :missing_refresh_token
  | :invalid_token_format
  | :missing_token_data
  | :invalid_oauth_response
  | :missing_access_token
  | :missing_scope
  | :missing_expiration
  | :invalid_access_token
  | :invalid_refresh_token
  | :invalid_expiration
  | :missing_token_type
  | :unsupported_token_type

t()

@type t() :: %Lightning.Credentials.OauthValidation.Error{
  details: map() | nil,
  message: String.t(),
  type: error_type()
}

Functions

new(type, message, details \\ nil)

@spec new(error_type(), String.t(), map() | nil) :: t()