Skip to content

[BUG] Contact form shows generic error alert instead of meaningful feedback #107

Description

@HKratos2001

Description

When the contact form submission fails (for any reason — duplicate email, missing fields, server error), the user sees a generic `alert("Form submit encountered an error, check console")`. This provides no actionable information.

Root Cause

Frontend (`/pages/patient/contactForm.vue`, lines 796-800):
```javascript
catch (e) {
console.log(e.statusMessage + ":");
console.log(e.data);
alert("Form submit encountered an error, check console");
}
// TODO make better than bandaid
```

Backend (`/server/api/contactForm/form.post.ts`, lines 75-77):
Uses `handlePrismaError(e)` which returns structured errors, but the frontend ignores the error details.

Fix

  1. Parse `e.data` and `e.statusMessage` from the server response
  2. Display specific error messages inline next to the relevant fields
  3. Common errors to handle:
    • Duplicate email → "An account with this email already exists"
    • Missing required field → highlight the field
    • Server error → "Something went wrong, please try again"
  4. Remove the `alert()` and `console.log` approach

Related

Acceptance Criteria

  • Error messages are shown inline near the relevant form field
  • No generic alerts or console-only errors
  • Each error type has a user-friendly message

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumImprovements, non-blocking bugsarea: formsContact form, request form, signupbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions