fix: preserve nonstandard API error responses - #13
Merged
Conversation
## Summary - preserve standard wrapped API errors and direct error objects - retain arbitrary JSON and plain-text error bodies instead of returning RequestError with nil Err - return a clear local diagnostic when an error response has an empty body - prefer the server X-Request-Id header, then fall back to the client request ID - add regression coverage for wrapped, direct, nonstandard JSON, text, and empty responses An empty body now produces `unexpected error response: empty body`; no placeholder is inserted into the body text. ## Context Found while running the public README Tokenization example with an intentionally invalid placeholder model. This is an existing SDK error-handling issue and is independent of the docs MR. ## Validation - targeted TestHandleErrorResp covering all five response shapes - go test ./... - go build ./... - go vet ./... - golangci-lint run ./... After this MR merges, docs/public-readme-byteplus will be rebased onto main and the CN/BP examples will be rerun. See merge request: !82 Sync-Source-Commit: 335e98443a9aa0fcfd7eb20c2351801805b84cf0 Ark-APIs-Commit: 665a2441c2c8d9342e4770d776ea19de36ef6f83 Hand-Written-Reason: Manual error-handling fix (preserve nonstandard API error responses). No ark-apis regeneration involved; attributed to the same ark-apis snapshot as parent 9763808. Release-Version: 0.3.0
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.
Hand-written change from the internal SDK repository — not produced by
make vendor.fix: preserve nonstandard API error responses665a2441c2c8d9342e4770d776ea19de36ef6f83Sync-Source-Commit: 335e98443a9aa0fcfd7eb20c2351801805b84cf0
Ark-APIs-Commit: 665a2441c2c8d9342e4770d776ea19de36ef6f83
Hand-Written-Reason: Manual error-handling fix (preserve nonstandard API error responses). No ark-apis regeneration involved; attributed to the same ark-apis snapshot as parent 9763808.
Release-Version: 0.3.0
Created by ark-hand.