| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Aws.Fault
Description
The amazonka edge of the transport-fault vocabulary. An adapter folds the AWS error sum into
Ecluse.Core.Fault as a value, or raises it past the adapter as AwsRequestFailed. A credential
failure that reaches no adapter, such as a background refresh, renders through displayAwsFaultT.
No form holds the request or the response headers, and a service's message keeps at most its first
line.
Synopsis
- classifyAwsTransport :: Error -> TransportFault
- classifyEscapedTransport :: SomeException -> Maybe TransportFault
- sendClassified :: AWSRequest a => (Error -> e) -> Env -> a -> IO (Either e (AWSResponse a))
- foldTransportEscapes :: (TransportFault -> fault) -> IO (Either fault a) -> IO (Either fault a)
- serviceStatus :: Error -> Maybe Int
- data AwsRequestFailed = AwsRequestFailed {}
- data AwsParty
- data AwsFault
- = AwsStatus AwsAnswer
- | AwsUndecodable Int
- | AwsHttp HttpFault
- data AwsAnswer = AwsAnswer {}
- sendRaising :: AWSRequest a => Env -> a -> IO (AWSResponse a)
- retypeAwsFailure :: IO a -> IO a
- data AwsCredentialFault
- retypeAmazonkaEscapes :: MonadUnliftIO m => m a -> m a
- displayAwsFaultT :: SomeException -> Text
- errorCodeText :: ErrorCode -> Text
Faults as values
classifyAwsTransport :: Error -> TransportFault Source #
Classify an amazonka error into the core transport vocabulary. A service's answer is detailed as AwsAnswer renders it.
classifyEscapedTransport :: SomeException -> Maybe TransportFault Source #
Classify only escaping AWS errors and bare HTTP exceptions, excluding credential and typed wrapper exceptions.
sendClassified :: AWSRequest a => (Error -> e) -> Env -> a -> IO (Either e (AWSResponse a)) Source #
Send a request with the AWS error folded into the caller's own fault type, a value rather than an exception.
foldTransportEscapes :: (TransportFault -> fault) -> IO (Either fault a) -> IO (Either fault a) Source #
Fold AWS and bare body-read transport exceptions into values. Other exceptions propagate.
serviceStatus :: Error -> Maybe Int Source #
The HTTP status a service answered with, or Nothing when the request never got an answer.
Faults raised past the adapter
data AwsRequestFailed Source #
A failed amazonka request raised past its adapter. It renders without the request: http-client redacts only Authorization, so a session-token header would print.
Constructors
| AwsRequestFailed | |
Instances
| Exception AwsRequestFailed Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods toException :: AwsRequestFailed -> SomeException # fromException :: SomeException -> Maybe AwsRequestFailed # | |
| Show AwsRequestFailed Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods showsPrec :: Int -> AwsRequestFailed -> ShowS # show :: AwsRequestFailed -> String # showList :: [AwsRequestFailed] -> ShowS # | |
| Eq AwsRequestFailed Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods (==) :: AwsRequestFailed -> AwsRequestFailed -> Bool # (/=) :: AwsRequestFailed -> AwsRequestFailed -> Bool # | |
Where a failed request went.
Constructors
| AwsEndpointAt Text Int | The host and port it was sent to. |
| AwsServiceNamed Text | The service that answered, named when no request is in reach. |
Why a request failed.
Constructors
| AwsStatus AwsAnswer | The service refused it. |
| AwsUndecodable Int | The service answered with this HTTP status, in a body |
| AwsHttp HttpFault | The HTTP exchange failed: a status from an endpoint outside the AWS protocol, or a transport fault. |
A service's refusal without its response headers. A signature error's message can quote the signed request, so it is dropped.
Constructors
| AwsAnswer | |
sendRaising :: AWSRequest a => Env -> a -> IO (AWSResponse a) Source #
Send a request, raising its failure as AwsRequestFailed. A service's answer is named by the endpoint the env sent the request to.
retypeAwsFailure :: IO a -> IO a Source #
Raise the amazonka or http-client failure of an action whose request the caller never holds, such as credential discovery, as a typed fault. An unparseable URL leaves as http-client's own exception.
Failures that reach no adapter
data AwsCredentialFault Source #
Why amazonka found no usable credentials when no request failed. It keeps the first line of amazonka's reason, never a file's contents.
Constructors
| AwsCredentialMissing Text | A setting a provider reads is missing: an environment variable or a file. |
| AwsCredentialUnusable Text | A credentials file or document could not be used. |
| AwsCredentialsExhausted | No provider in the chain found credentials. |
Instances
| Exception AwsCredentialFault Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods toException :: AwsCredentialFault -> SomeException # fromException :: SomeException -> Maybe AwsCredentialFault # | |
| Show AwsCredentialFault Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods showsPrec :: Int -> AwsCredentialFault -> ShowS # show :: AwsCredentialFault -> String # showList :: [AwsCredentialFault] -> ShowS # | |
| Eq AwsCredentialFault Source # | |
Defined in Ecluse.Runtime.Aws.Fault Methods (==) :: AwsCredentialFault -> AwsCredentialFault -> Bool # (/=) :: AwsCredentialFault -> AwsCredentialFault -> Bool # | |
retypeAmazonkaEscapes :: MonadUnliftIO m => m a -> m a Source #
Rethrow an amazonka error or credential failure escaping the action as its typed fault. Any other exception passes unchanged.
displayAwsFaultT :: SomeException -> Text Source #
displayFaultT, with an amazonka error or credential failure rendered as its typed fault's own text.
Error codes
errorCodeText :: ErrorCode -> Text Source #
An error code lowercased, so no comparison turns on a service's own casing.