Repository navigation
fix(platform): map raw backend errors to ConvexError codes for actionable UI messages (#2056) - #2172
Merged
Merged
Conversation
…able UI messages (#2056) Convex redacts raw `throw new Error(...)` messages to "Server Error" in production, so users hit unactionable failures and clients that branched on `error.message.includes(...)` were silently dead. Convert the expected-failure throws on three surfaces to `ConvexError({ code })` and map the codes to localized messages client-side. Surfaces: - [69] knowledge-entry + website duplicate: KNOWLEDGE_ENTRY_DUPLICATE, WEBSITE_DUPLICATE_DOMAIN. Replaces the dead `includes('already exists')` check with `convexErrorCode`. - [30] approval / human-input cards: UNAUTHENTICATED, NOT_FOUND, ALREADY_RESOLVED, INVALID_DECISION (approvals) and ALREADY_RESPONDED, NOT_EDITABLE, WORKFLOW_NOT_EDITABLE, GENERATION_IN_PROGRESS, INVALID_TYPE, NO_THREAD, BUDGET_EXCEEDED (human input). New `mapApprovalError` / `mapHumanInputError` mappers. - [88] automations triggers: UNAUTHENTICATED, INVALID_SLUG, NOT_INSTALLED, NOT_FOUND, APP_OWNED_WORKFLOW, INVALID_EVENT_TYPE, DUPLICATE_SUBSCRIPTION. New shared `mapTriggerError`; dialogs no longer collapse to a generic toast. i18n added in en/de/fr (de-CH inherits de). Regression tests assert every code is thrown server-side (convex-test runs the real mutations) and mapped client-side.
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 free
to 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 & why
Convex redacts raw
throw new Error(...)messages to "Server Error" in production. As a result, users hit unactionable failures, and clients that branched onerror.message.includes(...)were silently dead in prod. This converts the expected-failure throws on three surfaces toConvexError({ code })and maps the codes to localized messages client-side.Closes #2056.
Surfaces
[69] Knowledge-entry + website duplicate
KNOWLEDGE_ENTRY_DUPLICATE,WEBSITE_DUPLICATE_DOMAINerror.message.includes('already exists')check withconvexErrorCode. Maps to the existing duplicate toast (no new i18n needed for this surface).[30] Approval / human-input cards
UNAUTHENTICATED,NOT_FOUND,ALREADY_RESOLVED,INVALID_DECISIONALREADY_RESPONDED,NOT_EDITABLE,WORKFLOW_NOT_EDITABLE,GENERATION_IN_PROGRESS,INVALID_TYPE,NO_THREAD,BUDGET_EXCEEDED(carries a server-computed message)mapApprovalError/mapHumanInputErrormappers; cards no longer surface the prod-redacted message.[88] Automations triggers
UNAUTHENTICATED,INVALID_SLUG,NOT_INSTALLED,NOT_FOUND,APP_OWNED_WORKFLOW,INVALID_EVENT_TYPE,DUPLICATE_SUBSCRIPTIONmapTriggerError; the event/schedule dialogs no longer collapse every failure to a single generic toast.i18n
New error strings added to
en/de/frunderapprovalCommon,humanInputRequest, andautomations.triggers.errors.de-CHinheritsde.Tests
Regression tests assert every code is thrown server-side and mapped client-side:
convex-testruns the real mutations end-to-end, provingConvexErrorpropagation): knowledge-entries, websites, approvals, human-input, automations-trigger.Local gate: server + ui + i18n suites green,
tscclean,oxlintclean,oxfmtclean, SAST 0 findings.Note for reviewers
Approval/human-input failures are race-based (resolve in one tab, act in another). The duplicate cases ([69]) and duplicate event-trigger ([88]) are directly reproducible in the UI; see the test files for the exact conditions each code covers.