fix: return proper HTTP status codes and remove input coercion#129
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthrough汎用的なエラーを型付きエラークラス(NotFoundError、ValidationError、ConflictError)に置き換え、それぞれに対応するHTTPステータスコード(404、400、409)をマップする新しいエラー階層を導入しました。 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
#125: HTTP API now returns correct status codes: - 400 for validation errors (bad input, malformed JSON) - 404 for not found (run, job) - 409 for conflict (retrigger pending/leased, cancel completed, delete active) - 500 only for unexpected internal errors Added typed error classes: DurablyError, NotFoundError, ValidationError, ConflictError — all exported for user-land error handling. #127: Remove all input coercion in POST /trigger. body.input is passed directly to job.trigger() — Zod handles validation and returns 400 for invalid/missing input. No more silent null→{} or undefined→{} conversion. Closes #125 Closes #127 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e911378 to
b522887
Compare
Summary
Two issues fixed in one PR:
#125: HTTP API returns 500 for client errors
Added typed error classes (
DurablyError,NotFoundError,ValidationError,ConflictError) that carry HTTP status codes.withErrorHandlingnow maps them to proper responses:NotFoundErrorValidationErrorConflictErrorError#127: POST /trigger coerces null/missing input to {}
Removed
body.input ?? {}. Input is now passed as-is tojob.trigger(), letting Zod validation return a proper 400 for invalid input.Closes #125
Closes #127
Files changed
errors.ts— New error classesdurably.ts— Use typed errors in retrigger/cancel/deleteRunjob.ts— UseValidationErrorfor Zod failuresserver.ts— MapDurablyErrorto HTTP status inwithErrorHandlinghttp.ts— Add 409 to status code unionindex.ts— Export new error classesserver.shared.ts— Update tests to expect 409 instead of 500🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート
バグ修正
新機能