Skip to content

Improve raw object return error to preserve ctx.json guidance#153

Open
liangtovi-debug wants to merge 1 commit into
tscircuit:mainfrom
liangtovi-debug:codex/bounty-issue-30-ctx-json-guidance
Open

Improve raw object return error to preserve ctx.json guidance#153
liangtovi-debug wants to merge 1 commit into
tscircuit:mainfrom
liangtovi-debug:codex/bounty-issue-30-ctx-json-guidance

Conversation

@liangtovi-debug
Copy link
Copy Markdown

Fixes #30\n\n### What changed\n- Preserve non-Zod error messages in \n- Add regression test to ensure raw-object route returns keep the guidance message\n\n### Verification\n-

winterspec@0.0.114 pretest
npm run build

winterspec@0.0.114 prebuild
del dist

winterspec@0.0.114 build
tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json

winterspec@0.0.114 test
ava tests/errors/do-not-allow-raw-json.test.ts tests/errors/raw-json-preserves-helpful-message.test.ts

✔ do-not-allow-raw-json › should throw an error when responding with raw JSON
✔ raw-json-preserves-helpful-message › returning raw object keeps ctx.json guidance message

2 tests passed\n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When a user returns return { ... } from a route instead of return ctx.json({ ... }), throw an error telling them to use ctx.json

1 participant