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

    The client library's rendered detail, bounded to a log-line-sized budget. Diagnostic text only: it is never parsed, and no decision may branch 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 to the log-line budget, so a pathological rendered exception cannot bloat a log line or a held error value.

data TransportCause Source #

Why the transport could not deliver. Coarse on purpose: each constructor is a distinction an operator reads differently, and anything finer belongs in tfDetail.

Constructors

TransportTimeout

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

TransportUnreachable

The peer could not be reached at all: a refused or reset connection, or a name that did not resolve.

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, so the sum stays total over whatever a client library reports.

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.

transportRetryable :: TransportCause -> Bool Source #

Is a fault with this cause worth another attempt? A timeout and an unreachable peer can clear on their own. A TLS refusal and a protocol fault need an operator or a fix.

Retry delays

newtype RetryAfter Source #

A Retry-After delay, in whole seconds. A 'newtype' so a raw count of seconds is never confused with some other integer when it reaches a response header or a sweep's wait.

Constructors

RetryAfter Int 

The shared detail budget

boundedDetail :: Text -> Text Source #

Truncate a rendered detail to the shared log-line budget. Every fault vocabulary that carries diagnostic text bounds it identically.