Skip to main content
Things fail: networks, third-party APIs, user input. The patterns:

Three layers

1

Validation at the boundary

Convex schema validators reject malformed data before it touches your handler. Add business-rule validation in mutations.
2

Structured errors in functions

Throw with meaningful messages: throw new Error("Email already in use"). The client receives the message.
3

UX-friendly handling on the client

Catch errors at component boundaries; show a user-readable message; offer recovery actions.

Server-side patterns

ConvexError is structured — the client sees code and message separately.

Client-side patterns

Error boundaries

For UI-level failures (a render error):
vly’s default project structure ships with one error boundary at the app shell.

Retry policy

For transient failures:

Tips

Don’t swallow errors. A catch (err) { /* nothing */ } hides bugs. At minimum, log to Sentry.
Fail loudly in dev, gracefully in prod. Sentry + a toast + a clean UI fallback is the right default.

Input validation

The first defense.

Sentry integration

Error tracking.

Troubleshooting

Common errors.
Last modified on April 18, 2026