ValidationError
Thrown when input does not pass its schema.
Thrown when input does not pass its schema. It is an HttpError with status 400 whose
data carries the (bounded) issues, so the client can show them next to its fields.
Import#
ts
import { ValidationError } from "@shadow-js/dusk/server";
Signature#
ts
class ValidationError extends HttpError
Members#
| Name | Type | Description |
|---|---|---|
issues |
readonly issues: readonly ValidationIssue[] |
The issues, at most 20, each with a short message and a path. |
Examples#
ts
try { await createPost(input); } catch (error) { if (error instanceof ValidationError) show(error.issues); }