Constructor
# new ConflictError(msg) → {ConflictError}
Represents a conflict in the storage, typically when trying to create a duplicate resource
Error thrown when a conflict occurs in the storage
Parameters:
Name | Type | Description |
---|---|---|
msg |
string
|
Error
|
The error message or Error object |
A new ConflictError instance
Example
// Throw a conflict error when trying to create a duplicate record
const existingUser = await repository.findByEmail(email);
if (existingUser) {
throw new ConflictError(`User with email ${email} already exists`);
}