Repository navigation
Conversation
Non-400 JSON errors without a code field only promoted lower-case
snake_case `error` values to `code`. The relayer now answers 403 with
`{"error":"NOT_ALLOWED"}`, so the code was dropped. Accept upper-case
snake_case identifiers too and keep them as sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes DEFIQA-2402.
The relayer now answers 403 with
{"error":"NOT_ALLOWED"}. When a non-400 JSON error has nocodefield,ServiceClientonly promoted lower-case snake_caseerrorvalues tocode, so this one came back ascode: undefined.The fallback now also accepts upper-case snake_case identifiers and keeps them as sent. Mixed case and 400 responses are unchanged.
Testing
ServiceClienttest for a 403{"error":"NOT_ALLOWED"}responsepnpm exec vitest run --project client packages/client/src/ServiceClient.test.tspnpm typecheck🤖 Generated with Claude Code
Note
Low Risk
Localized change to JSON error code inference in the HTTP client, covered by a new unit test with no auth or data-handling impact.
Overview
Fixes
RequestRejectedError.codestayingundefinedwhen backends (e.g. the relayer) return non-400 JSON like{"error":"NOT_ALLOWED"}without a separatecodefield.ServiceClientnow treats upper-case snake_caseerror/ message values as fallback codes, alongside the existing lower-case rule. Explicitcodefields, 400 responses (no identifier promotion), and mixed-case strings are unchanged.Adds a 403 /
NOT_ALLOWEDregression test and a patch changeset for@polymarket/client.Reviewed by Cursor Bugbot for commit 67e5d38. Bugbot is set up for automated code reviews on this repo. Configure here.