fix: Keep the failed request reachable from Seam API errors - #1010
Open
razor-x wants to merge 4 commits into
Open
fix: Keep the failed request reachable from Seam API errors#1010razor-x wants to merge 4 commits into
razor-x wants to merge 4 commits into
Conversation
SeamHttpApiError discarded the underlying AxiosError, so the response headers, request config, and raw body were unrecoverable from a caught error. The 401 branch threw before parsing the response body, replacing the server diagnostic with a generic Unauthorized message. Validation errors were readable only by guessing a parameter name against a private field. Pass the AxiosError as the standard error cause on every Seam API error, parse the 401 response envelope when present and keep its message and data, and expose validationErrors and validationErrorParamNames on SeamHttpInvalidInputError so the failing parameters are enumerable, including nested validation errors. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
…x115l-m11c-error-fidelity
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
…x115l-m11c-error-fidelity
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.
Problem
SDK audit finding M11c (medium), three related error-surface gaps:
SeamHttpApiErrordropped the underlyingAxiosErroron the floor — status headers, request config, and the raw body were unrecoverable from a caught error.Unauthorizedmessage.validation_errorslived in a truly private field reachable only viagetValidationErrorMessages(name)— callers had to guess parameter names, and nested validation errors were unreachable.Fix
AxiosErroras its standardcause(error.cause.response,.config, etc.).messageanddatasurvive,code/statusCodestay pinned tounauthorized/401, with the generic message as fallback for non-JSON 401s.SeamHttpInvalidInputErrorgainsvalidationErrors(the raw object, nested paths included) andvalidationErrorParamNamesgetters;getValidationErrorMessagesunchanged.All constructor changes are backward-compatible (new optional parameters).
Tests
causeas the AxiosError with response and config (fails on reverted source)UnauthorizedvalidationErrorParamNamesand nestedvalidationErrorsFull suite (128 tests), lint, typecheck green.
Part of applying the rev-3 SDK audit (one PR per finding). Related: #1002–#1009.
🤖 Generated with Claude Code
https://claude.ai/code/session_01B8xeJm2Hd923k8uo6eoFd2
Generated by Claude Code