errs

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package errs holds the SDK's error types. They are re-exported from the top-level fal package (fal.Error, fal.HTTPError, ...) via type aliases, so most callers never import this package directly; it exists so that the transport, auth and feature packages can construct and match the same error values without a dependency on the facade.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string
}

Error is the base error type for the SDK. It mirrors fal_client.FalClientError.

HTTPError, TimeoutError and MissingCredentialsError are distinct concrete types rather than wrappers of Error; use errors.As to inspect them.

func (*Error) Error

func (e *Error) Error() string

type HTTPError

type HTTPError struct {
	Message    string
	StatusCode int
	Headers    http.Header
	ErrorType  string
}

HTTPError is returned when the API responds with a non-2xx status. It mirrors fal_client.FalClientHTTPError.

For security, HTTPError never carries request headers, and credential-bearing response headers are redacted before being stored in Headers. Construct it only via NewHTTPError, which applies that redaction; never build it directly, and do not mutate Headers after construction (doing so could reintroduce a credential that redaction removed).

func NewHTTPError

func NewHTTPError(statusCode int, data []byte, header http.Header) *HTTPError

NewHTTPError builds a redacted *HTTPError from a non-2xx response's status, body and headers. It is the only constructor: redaction of the credential headers happens here, so an HTTPError can never escape with a live token.

The error type is taken from the X-Fal-Error-Type header, then overridden by an "error_type" field in the JSON body if present. The message is the body's "detail" field (string or raw JSON) when present, otherwise the raw body.

func (*HTTPError) Error

func (e *HTTPError) Error() string

type MissingCredentialsError

type MissingCredentialsError struct {
	Message string
}

MissingCredentialsError is returned when no fal credentials can be resolved.

func (*MissingCredentialsError) Error

func (e *MissingCredentialsError) Error() string

type TimeoutError

type TimeoutError struct {
	Timeout   time.Duration
	RequestID string
}

TimeoutError is returned when subscribe exceeds its client timeout. It mirrors fal_client.FalClientTimeoutError.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL