ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Fault

Description

The core transport-fault vocabulary. A client-library adapter classifies its own exceptions at its edge, so no consumer layer ever sees the library's exception type.

Synopsis

Transport faults

data TransportFault Source #

One classified transport failure. Build it with transportFault so the detail stays bounded.

Constructors

TransportFault 

Fields

  • tfCause :: TransportCause

    The closed classification a consumer or an operator reads.

  • tfDetail :: Text

    What the adapter knows beyond the cause, bounded to a log line. Diagnostic only: never parsed, and no decision branches on it.

Instances

Instances details
Show TransportFault Source # 
Instance details

Defined in Ecluse.Core.Fault

Eq TransportFault Source # 
Instance details

Defined in Ecluse.Core.Fault

transportFault :: TransportCause -> Text -> TransportFault Source #

Build a TransportFault with the detail truncated, so a pathological exception cannot bloat a log line or a held value.

data TransportCause Source #

Why the transport could not deliver. Coarse on purpose: each constructor reads differently to an operator, and the rest goes in tfDetail.

Constructors

TransportTimeout

The peer did not answer in time (a connect, response, or socket timeout).

TransportUnreachable

The peer could not be reached at all: a refused connection, a failed lookup, or a peer that closed or reset before answering.

TransportTls

The TLS layer refused the peer (a handshake or certificate failure).

TransportProtocol

Any other client-reported fault (a malformed response, an unparseable URL, an internal client error): the closed catch-all.

Instances

Instances details
Show TransportCause Source # 
Instance details

Defined in Ecluse.Core.Fault

Eq TransportCause Source # 
Instance details

Defined in Ecluse.Core.Fault

renderTransportCause :: TransportCause -> Text Source #

What a transport cause says happened, for a line an operator reads.

renderTransportFault :: TransportFault -> Text Source #

A transport fault for a log line: its detail, then its cause.

transportRetryable :: TransportCause -> Bool Source #

Whether another attempt can help. A timeout and an unreachable peer clear on their own, and a TLS or protocol fault needs a fix.

HTTP faults

data HttpFault Source #

A failed HTTP exchange without its request or its response, either of which can carry a credential.

Constructors

HttpStatus Int

The peer answered with this non-2xx status.

HttpTransport TransportFault

The transport delivered no usable answer.

Instances

Instances details
Show HttpFault Source # 
Instance details

Defined in Ecluse.Core.Fault

Eq HttpFault Source # 
Instance details

Defined in Ecluse.Core.Fault

renderHttpFault :: Text -> HttpFault -> Text Source #

A fault for a log line. A status follows its source's host:port, and a transport fault reads from its detail, which names the endpoint.

Retry delays

newtype RetryAfter Source #

A Retry-After delay in whole seconds, never confused with another integer on its way to a header or a sweep's wait.

Constructors

RetryAfter Int 

The shared detail budget

boundedDetail :: Text -> Text Source #

Truncate a rendered detail to the log-line budget every fault vocabulary shares.