fix: improve error handling and response messages in webhook and user…#62
Conversation
… routes - Updated the webhook error response to use return for consistency in handling. - Changed the status code for invalid Zod schema errors from FORBIDDEN to BAD_REQUEST for better clarity. - Modified error toast message in WorkflowCanvas to accurately reflect the failure context during workflow execution.
📝 WalkthroughWalkthroughThis PR implements three targeted error handling improvements across the hooks, backend, and web layers: making the webhook catch block return a terminal HTTP 500 response, correcting the /executeWorkflow validation error status from 403 to 400, and updating the workflow execution error message from "Failed to save config" to "Failed to Execute Workflow". Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Pull request overview
This PR improves error handling and user-facing messages across the workflow execution system. The changes correct a misleading error message, improve HTTP status code semantics for validation errors, and ensure consistent response handling in the webhook endpoint.
Changes:
- Fixed error toast message in WorkflowCanvas to accurately reflect workflow execution failure instead of config save failure
- Changed HTTP status code from FORBIDDEN (403) to BAD_REQUEST (400) for Zod schema validation errors, better reflecting the nature of client input errors
- Added return statement to webhook error response for consistency and to prevent potential issues with response handling
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/web/app/workflows/[id]/page.tsx | Updated error toast message to correctly indicate workflow execution failure |
| apps/http-backend/src/routes/userRoutes/userRoutes.ts | Changed validation error status code from FORBIDDEN to BAD_REQUEST for better semantic accuracy |
| apps/hooks/src/index.ts | Added return statement to error response for consistency with success path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!parsedData.success) { | ||
| return res.status(statusCodes.FORBIDDEN).json({ | ||
| return res.status(statusCodes.BAD_REQUEST).json({ | ||
| message: "Error in Zod Schma", |
There was a problem hiding this comment.
The error message contains a spelling error: "Schma" should be "Schema".
| message: "Error in Zod Schma", | |
| message: "Error in Zod Schema", |
… routes
Summary by CodeRabbit
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.