Constructor
# new BaseError(name, msg, code) → {void}
Abstract base error class that all other error types extend from. Provides common error handling functionality and standardized HTTP code mapping.
Base error class for the repository module
sequenceDiagram
participant C as Caller
participant E as BaseError
C->>E: new BaseError(name,msg,code)
E-->>C: Error instance with message and code
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
The name of the error |
msg |
string
|
Error
|
The error message or Error object to wrap |
code |
number
|
The HTTP status code associated with this error |
void
Example
// This is an abstract class and should not be instantiated directly
// Instead, use one of the concrete error classes:
throw new ValidationError('Invalid data provided');