| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data TransportFault = TransportFault {}
- transportFault :: TransportCause -> Text -> TransportFault
- data TransportCause
- renderTransportCause :: TransportCause -> Text
- renderTransportFault :: TransportFault -> Text
- transportRetryable :: TransportCause -> Bool
- data HttpFault
- renderHttpFault :: Text -> HttpFault -> Text
- newtype RetryAfter = RetryAfter Int
- boundedDetail :: Text -> Text
Transport faults
data TransportFault Source #
One classified transport failure. Build it with transportFault so the detail stays bounded.
Constructors
| TransportFault | |
Fields
| |
Instances
| Show TransportFault Source # | |
Defined in Ecluse.Core.Fault Methods showsPrec :: Int -> TransportFault -> ShowS # show :: TransportFault -> String # showList :: [TransportFault] -> ShowS # | |
| Eq TransportFault Source # | |
Defined in Ecluse.Core.Fault Methods (==) :: TransportFault -> TransportFault -> Bool # (/=) :: TransportFault -> TransportFault -> Bool # | |
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
| Show TransportCause Source # | |
Defined in Ecluse.Core.Fault Methods showsPrec :: Int -> TransportCause -> ShowS # show :: TransportCause -> String # showList :: [TransportCause] -> ShowS # | |
| Eq TransportCause Source # | |
Defined in Ecluse.Core.Fault Methods (==) :: TransportCause -> TransportCause -> Bool # (/=) :: TransportCause -> TransportCause -> Bool # | |
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
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. |
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 |
Instances
| Show RetryAfter Source # | |
Defined in Ecluse.Core.Fault Methods showsPrec :: Int -> RetryAfter -> ShowS # show :: RetryAfter -> String # showList :: [RetryAfter] -> ShowS # | |
| Eq RetryAfter Source # | |
Defined in Ecluse.Core.Fault | |
| Ord RetryAfter Source # | |
Defined in Ecluse.Core.Fault Methods compare :: RetryAfter -> RetryAfter -> Ordering # (<) :: RetryAfter -> RetryAfter -> Bool # (<=) :: RetryAfter -> RetryAfter -> Bool # (>) :: RetryAfter -> RetryAfter -> Bool # (>=) :: RetryAfter -> RetryAfter -> Bool # max :: RetryAfter -> RetryAfter -> RetryAfter # min :: RetryAfter -> RetryAfter -> RetryAfter # | |
The shared detail budget
boundedDetail :: Text -> Text Source #
Truncate a rendered detail to the log-line budget every fault vocabulary shares.