Consolidate web errorMessage onto the shared helper - #926
Merged
Conversation
Completes the errorMessage sweep started server-side in #914. apps/web carried a byte-identical reimplementation in jobs-helpers.tsx plus one inline copy in markdown.tsx; both now route through the canonical apps/server/src/shared/lib/error-message.ts. Web imports a VALUE here, so it follows the #844/#849 shape: a new dependency-free re-export module at apps/web/src/lib/errors.ts keeps call sites on "@/lib/..." instead of reaching across the boundary directly. Test coverage for the helper already exists in apps/server/test/error-message.test.ts and is a strict superset of the jobs-helpers.test.tsx block, which is dropped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Completes the
errorMessageregression sweep started server-side in #914.apps/webhad its own copy of the helper plus one inline ternary; both now use the canonicalapps/server/src/shared/lib/error-message.ts.errorMessageinapps/web/src/components/app/jobs-helpers.tsxand re-pointed its four importers (jobs-add-dialog,jobs-detail-pane,jobs-prompt-tab,jobs-settings-tab).err instanceof Error ? err.message : String(err)inapps/web/src/components/ui/markdown.tsx:211(mermaid render error path).apps/web/src/lib/errors.ts, a thin re-export of the shared helper.errorMessagedescribe block fromjobs-helpers.test.tsx—apps/server/test/error-message.test.tsalready covers a strict superset (adds Error subclasses andnull).Net −19 lines. Zero behavior change: both removed expressions were byte-equivalent to the helper body.
Why this shape
Web imports a value here, not a type, so per the #844/#849 pattern it needs a dependency-free source module —
shared/lib/error-message.tsqualifies (zero imports). The new@/lib/errorsre-export keeps web call sites on@/lib/...instead of reaching across theapps/serverboundary directly, matchinglib/agent-types.ts,lib/ide-types.ts, andlib/media-upload.ts.finalize:webconfirms the value import bundles cleanly.Deliberately NOT swept
A grep for
instanceof Erroracrossapps/web/srcreturns 29 non-test sites. Only the 2 above were byte-equivalent; the other 27 carry distinct fallbacks and must keep them. Enumerated so a future run doesn't re-litigate:"Failed to load jobs.","Failed to save.","Failed to send test.","Failed to save browser notifications.","Failed to load/save IDE settings.","Failed to create agent.","Couldn't load branches.","Failed to save cross-repo messaging setting.","Upload failed","Failed to load personalities.","Failed to set active personality.","Failed to delete.","Failed to save prompt delivery setting.","Failed to load/save agent type settings.","Failed to check for updates","Failed to start assisted update","Session connection failed."— plus"Failed to load release info"/`Failed to promote ${tag}`.undefinedfallback (2):session-settings-dialog.tsx:61,agent-card-header.tsx:80— a toastdescriptionthat is deliberately omitted for non-Errors.nullfallback (1):persona-launcher.tsx:183.cleanError(err.message)inrelease-admin.tsx×2 anduse-release-updates.ts×2;`Couldn't start update: ${err.message}`inrelease-available-toast.tsx:154.Validation
pnpm run check,pnpm run finalize:web, web vitest (732 passed / 56 files),pnpm run test:e2e(178 passed, 12 skipped) — all green. Server unit tests not run: no backend files changed.Next run
Queued:
formatDatename collision — three identically-named one-line wrappers over@/lib/formatwith three different behaviors (activity-chart-utils.ts:3,release-utils.ts:24,jobs-helpers.ts:43).🤖 Generated with Claude Code