Class AwsErrors
java.lang.Object
codes.grow.packages.awssecretsmanager.AwsErrors
Maps AWS SDK errors to the SPEC section 2.1 error classes by AWS error code (AWS JSON
services answer HTTP 400 for throttling and access denied, so status mapping alone is wrong; see
API.md section 1.1). The HTTP status is only the fallback.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionawsErrorCode(Throwable error) Returns the AWS error code behind an error (the error itself or one of its causes).Returns the canonical code of an AWS error code.codeFromBody(String text) Extracts an error code from an XML (<Code>) or JSON (__type) error body.static AwsSecretsManagerExceptionConverts anything the AWS SDK throws into an SDK exception with the message"<operation>: <AwsCode>: <redacted vendor text> (HTTP <status>)".
-
Field Details
-
CODES
AWS error code to canonical code.
-
-
Method Details
-
codeFor
Returns the canonical code of an AWS error code.- Parameters:
awsCode- AWS error code such asResourceNotFoundException, may be null- Returns:
- the code, or empty when unknown
-
awsErrorCode
Returns the AWS error code behind an error (the error itself or one of its causes).- Parameters:
error- any throwable, may be null- Returns:
- the AWS error code, or empty when the error did not come from an AWS error response
-
codeFromBody
Extracts an error code from an XML (<Code>) or JSON (__type) error body.- Parameters:
text- body text, may be null- Returns:
- the code, or empty
-
map
public static AwsSecretsManagerException map(Throwable error, String operation, Collection<String> knownSecrets, Duration totalTimeout) Converts anything the AWS SDK throws into an SDK exception with the message"<operation>: <AwsCode>: <redacted vendor text> (HTTP <status>)". Known secret values are redacted; request bodies never appear.- Parameters:
error- the erroroperation- Grow operation, e.g."getSecretValue app/db"knownSecrets- values to redacttotalTimeout- the configured total timeout (for the message), may be null- Returns:
- the mapped exception (an SDK exception is returned unchanged)
-