Class

ValidationError

ValidationError(msg) → {ValidationError}

Constructor

# new ValidationError(msg) → {ValidationError}

Represents a failure in the Model details, typically thrown when data validation fails

Error thrown when validation fails

Parameters:
Name Type Description
msg string | Error

The error message or Error object

View Source repository/errors.ts, line 26

A new ValidationError instance

Example
// Throw a validation error when data is invalid
if (!isValid(data)) {
  throw new ValidationError('Invalid data format');
}