Skip to content

Bug: Duplicate website/customer/vendor add throws a raw Error (not ConvexError) → uncaught Server Error in the client console #1993

Closed

Description

@yannickmonney

What happened?

Adding a website (or customer/vendor) whose normalized identifier already exists rejects correctly in the UI (destructive toast, no duplicate row created), but the rejection is a plain throw new Error(...) rather than a ConvexError, so it is logged to the client console as an uncaught Convex Server Error. Downstream the UI relies on fragile string-matching of the message.

Steps to reproduce

  1. Add a website with domain X → success.
  2. Add the same domain X again → toast "This website has already been added", no dup row, BUT the console logs an uncaught server fault.

Expected behavior

Expected business rejections use ConvexError with a typed code (no uncaught Server Error in the console; no string-matching needed downstream).

Affected service

Platform (web app)

Version or commit

cd13268b8

Browser and OS

Headless Chrome (Playwright) on macOS

Relevant log output / evidence

services/platform/convex/websites/create_website.ts:43 — throw new Error("Website with domain … already exists"). The sibling create/update/delete/bulk paths for customers and vendors (and the secret/title validators) follow the same raw-Error pattern.

Fix. Throw ConvexError({ code: 'DUPLICATE_…' }) from these paths and match on the code, not the message string.


Filed by an automated deep manual-QA sweep (wave 2) on a local hermetic stack (commit cd13268b8, mode-A mock LLM, headless Chrome). Reproduced before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedbugpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions