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 |
A new ValidationError instance
Example
// Throw a validation error when data is invalid
if (!isValid(data)) {
throw new ValidationError('Invalid data format');
}