Class AwsErrors

java.lang.Object
codes.grow.packages.cloudwatchlogs.AwsErrors

public final class AwsErrors extends Object
Maps AWS SDK errors to the SPEC section 2.1 exception classes (API.md section 1.1): AWS error code first, then the HTTP status, then network, timeout and cancellation shapes. Messages read "<operation>: <reason>: <AwsCode> (HTTP <status>)"; AWS messages are never copied into the message (they may echo log data) and the cause is redacted with the known secrets.
  • Field Details

    • AWS_ERROR_CODES

      public static final Map<String,ErrorCode> AWS_ERROR_CODES
      AWS error codes and the Grow code they map to.
  • Method Details

    • awsErrorCode

      public static Optional<String> awsErrorCode(Throwable error)
      Returns the AWS error code of an SDK error (without a namespace# prefix), also when it is wrapped in a CompletionException or carried as the cause of a mapped SDK exception.
      Parameters:
      error - any throwable
      Returns:
      the code, or empty
    • map

      public static CloudWatchLogsException map(String operation, Throwable error, Collection<String> knownSecrets)
      Maps any error of an AWS SDK call to a CloudWatchLogsException. An SDK exception is returned unchanged.
      Parameters:
      operation - operation name for the message
      error - the error
      knownSecrets - values to redact from the cause
      Returns:
      the mapped exception