Improve error handling and metrics visibility#611
Open
satyakigh wants to merge 2 commits into
Open
Conversation
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/vitestThe overall coverage in the branch remains at 89%, unchanged from the branch. Show a code coverage summary of the most impacted files.
Code Coverage is in Public Preview. Learn more and provide us with your feedback. |
kddejong
approved these changes
Jun 18, 2026
kddejong
approved these changes
Jun 18, 2026
kddejong
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Verified the telemetry data paths — no new user data exposure. errorType() now always emits error.type/error.code (structural metadata only, sanitized), and error.message/error.stack remain gated behind captureErrorAttributes. Import graph is a clean DAG, no circular dependency risk. Test coverage is comprehensive.
Zee2413
reviewed
Jun 22, 2026
| url: url, | ||
| responseType: 'arraybuffer', | ||
| proxy: getProxyConfig(), | ||
| maxRedirects: 7, |
Contributor
There was a problem hiding this comment.
Why this change in this PR?
Zee2413
reviewed
Jun 22, 2026
|
|
||
| const CLIENT_FAULT_CATEGORIES: ReadonlySet<AwsErrorCategory> = new Set(['credentials', 'network', 'permissions']); | ||
|
|
||
| export function isClientError(error: unknown): boolean { |
Contributor
There was a problem hiding this comment.
Since we are making the distinction, let's rename this to isAwsClientError
Zee2413
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the error-handling and telemetry plumbing to surface richer, structured information when errors occur, while tightening the rules around what counts as a "client error" (and therefore should be suppressed as a fault). Stack-trace sanitization is extracted into a reusable module, and AWS-aware classification is propagated into telemetry attributes.
Extracts the previously inline stack-sanitization logic from Errors.ts / ErrorStackInfo.ts into a standalone, reusable module:
Replaces the old determineSensitiveInfo() cache helper with the actual error-attribute extraction logic (moved out of Errors.ts):
ScopedTelemetry.error() — always emit error type by default
Previously error.type and error.code were only attached when the caller opted in. Now they are emitted unconditionally; captureErrorAttributes only controls whether the more verbose error.message / error.stack / cause attributes are included.
FaultSuppression.ts — symbol-keyed flag, broader marking
Network error names are now built by merging AWS_NETWORK_ERROR_NAMES (NetworkingError, TimeoutError) with the canonical CLIENT_NETWORK_ERROR_CODES set from Errors.ts, removing the previously duplicated errno list.