FederationError

public enum FederationError : Error, Sendable

Errors that can occur during SEP-0002 federation operations.

This enumeration represents all possible failure cases when resolving Stellar addresses, performing reverse lookups, or communicating with federation servers.

  • The provided Stellar address format is invalid.

    Occurs when the address does not contain the required “*” separator or does not follow the “username*domain.tld” format.

    Example invalid addresses: “alice”, “alice@example.com”, “alice*”

    Declaration

    Swift

    case invalidAddress
  • The provided Stellar account ID format is invalid.

    Occurs when attempting reverse lookup with an account ID that is not a valid Stellar public key (must start with G and be 56 characters total).

    Example: “INVALID123” or malformed public keys

    Declaration

    Swift

    case invalidAccountId
  • The domain extracted from the Stellar address is invalid.

    Occurs when the domain portion of the address does not conform to RFC 1035 domain name specifications.

    Declaration

    Swift

    case invalidDomain
  • The domain specified for stellar.toml lookup is invalid.

    Occurs when attempting to fetch stellar.toml from a domain that does not meet the required format or cannot be resolved.

    Declaration

    Swift

    case invalidTomlDomain
  • The stellar.toml file could not be parsed or contains invalid data.

    Occurs when the stellar.toml file is malformed, missing required fields, or contains syntax errors.

    Declaration

    Swift

    case invalidToml
  • The stellar.toml file does not specify a federation server.

    Occurs when the FEDERATION_SERVER field is missing from the stellar.toml file at the specified domain, indicating the domain does not support federation.

    Declaration

    Swift

    case noFederationSet
  • The federation server response could not be parsed.

    Occurs when the server returns data that does not match the expected JSON structure or contains invalid field values.

    Declaration

    Swift

    case parsingResponseFailed(message: String)

    Parameters

    message

    Detailed error message describing the parsing failure

  • An underlying HTTP request error occurred when communicating with the server.

    Occurs when the federation server request fails due to network issues, server errors (5xx), not found (404), or other HTTP-level problems.

    Declaration

    Swift

    case horizonError(error: HorizonRequestError)

    Parameters

    error

    The underlying HorizonRequestError with details about the failure