| 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
- transportRetryable :: TransportCause -> Bool
- 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 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
| 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.
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 |
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 shared log-line budget. Every fault vocabulary that carries diagnostic text bounds it identically.