Skip to content

fix: throw actionable error for plain object route returns#145

Open
colorbank wants to merge 1 commit into
tscircuit:mainfrom
colorbank:fix/issue-30-ctx-json-error
Open

fix: throw actionable error for plain object route returns#145
colorbank wants to merge 1 commit into
tscircuit:mainfrom
colorbank:fix/issue-30-ctx-json-error

Conversation

@colorbank
Copy link
Copy Markdown

Summary

  • improve the plain-object route return error to be more actionable
  • include request method/path context in the error message
  • include a concrete fix example:
    eturn ctx.json({ ok: true })
  • keep existing valid ctx.json(...) flow unchanged

Verification

  • npm test -- tests/errors/do-not-allow-raw-json.test.ts
  • npm test -- tests/errors/invalid-response-error.test.ts

/claim #30

@colorbank
Copy link
Copy Markdown
Author

🚀 PR ready for review!

✅ Build: Passed all tests
✅ Functionality: Error message improvement for route returns
✅ Tests: Regression tests passing (do-not-allow-raw-json.test.ts, invalid-response-error.test.ts)

The fix enhances developer guidance when returning plain objects instead of using ctx.json({ ... }).

Example: 'Invalid route return value for GET /. Use ctx.json({...}) instead of returning an object directly. Example: return ctx.json({ ok: true }).'

Ready to merge at your convenience! 🎯

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant