Skip to content
Welcome to the Gluegun documentation!

gluegun/error

Error types returned by Gluegun effectful APIs.

Match variants such as Timeout, ConnectionDown, and InvalidMessage for application-specific recovery, and keep a fallback for Erlang or decode errors.

Errors returned by Gluegun connection, request, message, and WebSocket APIs.

Match the variants relevant to your application and keep a fallback for ErlangError / DecodeError, which can occur when Gun returns shapes Gluegun cannot normalize.

pub type GluegunError {
Timeout
ConnectionDown(String)
ConnectionError(String)
StreamError(String)
InvalidOptions(String)
InvalidMessage(String)
UnsupportedFeature(String)
ErlangError(String)
DecodeError(String)
}

An operation did not complete within the configured Timeout. Retry, extend the timeout, or fall back to a degraded path.

Gun reported the connection went down. The string carries Gun's reason. Reopen the connection before retrying.

Gun could not establish or maintain the connection (DNS, TCP, TLS). Inspect the reason string and adjust transport or TLS options.

A stream-level error occurred (cancelled, reset, protocol error). Open a new stream; the connection may still be usable.

Caller passed options Gun rejected (e.g. non-positive flow window). Fix the options and retry.

Gun delivered a message Gluegun could not classify, or the high-level client helpers received push/upgrade/WebSocket on a regular request. Use the low-level request/message APIs for those flows.

The requested feature is not supported (e.g. WebSocket over HTTP/2). Choose an alternative protocol or transport.

A generic Erlang-side error that did not match a tagged shape. Inspect the reason string for debugging.

A response body, frame, or message could not be decoded into the expected Gleam type. Often a UTF-8 or protocol-shape mismatch.