fix: add NEXT_REDIRECT error handling to update todo action#19
fix: add NEXT_REDIRECT error handling to update todo action#19jezweb wants to merge 1 commit intoifindev:mainfrom
Conversation
Add proper handling for Next.js redirect errors in updateTodoAction to match the pattern used in createTodoAction. Without this, redirect() calls from server actions could be incorrectly logged as errors. Changes: - Check if error message is 'NEXT_REDIRECT' before error logging - Re-throw NEXT_REDIRECT errors unchanged to allow proper redirection - Prevents false error logs in console for successful operations This matches the existing pattern in create-todo.action.ts for consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded@jezweb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 39 seconds before requesting another review. ⌛ 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. 📒 Files selected for processing (1)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
- Filter out NEXT_REDIRECT errors in toast.promise error handler - NEXT_REDIRECT is Next.js flow control, not an actual error - Fixes interaction issue between PR ifindev#19 and PR ifindev#23
Problem
The
updateTodoActionwas missing proper handling for Next.js redirect errors. Whenredirect()is called from a server action, it throws a special error with message"NEXT_REDIRECT"that should be re-thrown unchanged to allow the redirect to complete properly.Without this handling, redirect errors would:
Solution
Add NEXT_REDIRECT error handling to match the pattern already used in
createTodoAction.Changes
src/modules/todos/actions/update-todo.action.ts:'NEXT_REDIRECT'before error loggingPattern Consistency
This fix brings
updateTodoActionin line withcreateTodoActionwhich already has this handling:🤖 Generated with Claude Code