Validation error for input validation failures
Thrown when user input fails validation (e.g., invalid country code, out of range limit, malformed ID). Always returns HTTP 400 status.
if (!isValidCountryCode(country)) { throw new ValidationError( 'Invalid country code', { country, expected: 'ISO 3166-1 alpha-2' } );} Copy
if (!isValidCountryCode(country)) { throw new ValidationError( 'Invalid country code', { country, expected: 'ISO 3166-1 alpha-2' } );}
Create a new validation error
Description of validation failure
Optional
Optional details about what failed validation
Readonly
Machine-readable error code (e.g., 'VALIDATION_ERROR')
HTTP status code (default: 500)
Optional additional error details for debugging
Validation error for input validation failures
Thrown when user input fails validation (e.g., invalid country code, out of range limit, malformed ID). Always returns HTTP 400 status.
Example