Expand description
Helpers for diagnosing AWS SDK errors.
SdkError’s Display impl collapses everything below the SDK
(DNS, TCP, TLS, connector pool, credential providers) into a single
short string like "dispatch failure", which makes prod logs nearly
useless for distinguishing root causes.
This module provides two utilities meant to be paired at every AWS SDK call-site:
classify_sdk_error— returns a stable, low-cardinality&'static strsuitable for atracingfield or metric label, distinguishing the actionable subcategories ofDispatchFailure(timeout / io / user / other) fromTimeoutError,ServiceError, etc.DisplayErrorContext— re-export of the SDK’s own helper that walks the fullstd::error::Error::source()chain so the underlying cause (e.g.,connect timed out,dns error: failed to lookup address) appears in the log instead of just the top-level wrapper.
§Caution: log-only — do not embed in returned error values
DisplayErrorContext walks the underlying SDK chain and can surface
internal infrastructure details (endpoint URLs, connector kinds,
credential-provider failures). Keep it confined to tracing fields
and metrics. For error values returned to upstream callers — which
ultimately reach API clients via ApiError::InternalError(err.to_string()) —
prefer the stable kind tag from classify_sdk_error.
Typical usage:
tracing::error!(
error.kind = classify_sdk_error(&err),
error.detail = %DisplayErrorContext(&err),
"AWS call failed"
);
// Returned error value carries only the kind tag, not the full chain:
return Err(MyError::Wrapped(format!("op X failed: {}", classify_sdk_error(&err))));Structs§
- Display
Error Context - Provides a
Displayimpl for anErrorthat outputs the full error context
Functions§
- classify_
sdk_ error - Classify an [
SdkError] into a stable, low-cardinality kind tag.