fix(ws,sidebar): structured error payload and prevent horizontal overflow on project import#1045
Conversation
…flow on project import - Add WsError schema (code, message, path) and WS_ERROR_CODES in contracts - Server returns typed errors instead of raw Cause.pretty stack traces - PROJECT_DIR_NOT_EXIST / PROJECT_PATH_NOT_DIRECTORY with user-friendly message - Path included for debugging but not displayed in UI - Sidebar: min-w-0, overflow-hidden, break-words to prevent horizontal scroll when error messages or long paths are shown in add-project form
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
Summary
Fixes UX issues when adding a project with an invalid path: raw stack traces in error messages and horizontal scrollbar overflow in the sidebar.
What changed
WsErrorschema andWS_ERROR_CODESfor typed WebSocket error responsesbuildWsErrorForClient()normalizes errors to{ code, message, path? }— users see "Project directory does not exist" instead of stack tracesmin-w-0,overflow-hidden,break-wordson add-project form to prevent horizontal overflow when error text is longWhy
Before / After
Before: Raw stack trace in UI, horizontal scrollbar
After: Clean message "Project directory does not exist", text wraps without overflow
Future improvement: A cleaner approach would be to add
codeandpathtoRouteRequestErrorwhen it is created. The current message based detection is used becauseSchema.is(RouteRequestError)did not reliably match when extracting the defect fromCause.squash.Note
Add structured
WsErrorpayload with error codes and fix sidebar overflow on project importWS_ERROR_CODESand aWsErrorschema inpackages/contracts/src/ws.tswithcode,message, and optionalpathfields, replacing the previous{ message: string }shape.buildWsErrorForClientutility inapps/server/src/wsServer.tsthat maps internal Effect/Cause failures to structured errors, including specific codes for known project path errors.apps/web/src/components/Sidebar.tsxby addingmin-w-0,overflow-hidden, andbreak-wordsto the project path entry container and error message.codefield; clients expecting only{ message }will need to handle the new shape.Macroscope summarized e82eac4.