Repository navigation
fix: preserve BigInt values when formatting HTTP errors - #851
Merged
wolfy1339 merged 2 commits intoNov 29, 2026
Merged
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
wolfy1339
approved these changes
Nov 29, 2026
|
🎉 This PR is included in version 10.0.18 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Resolves #850
Before the change?
JSONParsepreserves large JSON integers asBigInt, buttoErrorMessageuses built-inJSON.stringifyfor error details and fallback bodies. A valid HTTP error containing such an integer therefore throwsTypeError: Do not know how to serialize a BigIntbeforeRequestErrorcan be constructed, losing the status/request/response context.After the change?
Reuse the already-imported
JSONStringifyat both formatting sites. HTTP errors retain their status, their parsed response (including exact BigInt values), and a readable message. No new dependency or public API change is needed.Added six regressions for nested error details, primitive error details, and object/array/positive-integer/negative-integer fallback bodies. Each checks the
RequestErrorinstance, status, message, request metadata, and parsed response. All six fail on unmodified main and pass with the fix.Validation on Windows:
npm run build: passed.npm run lint -- --end-of-line auto: passed. Plainnpm teststops in its lint pre-step because this Windows checkout uses CRLF in unchanged files; the full suite above was run directly usingnode node_modules/vitest/vitest.mjs run --coverage. No formatter configuration or unrelated files were changed.Pull request checklist
No documentation update is needed: this restores the existing HTTP error contract rather than adding behavior users must configure.
Does this introduce a breaking change?