ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

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

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 

data AwsParty Source #

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.

Instances

Instances details
Show AwsParty Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

Eq AwsParty Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

data AwsFault Source #

Why a request failed.

Constructors

AwsStatus AwsAnswer

The service refused it.

AwsUndecodable Int

The service answered with this HTTP status, in a body amazonka could not decode.

AwsHttp HttpFault

The HTTP exchange failed: a status from an endpoint outside the AWS protocol, or a transport fault.

Instances

Instances details
Show AwsFault Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

Eq AwsFault Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

data AwsAnswer Source #

A service's refusal without its response headers. A signature error's message can quote the signed request, so it is dropped.

Constructors

AwsAnswer 

Fields

Instances

Instances details
Show AwsAnswer Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

Eq AwsAnswer Source # 
Instance details

Defined in Ecluse.Runtime.Aws.Fault

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.

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.