- createError<D>(name: string, ParentError?: ErrorConstructor & {
extend?: undefined;
}, options?: Options): CustomErrorConstructor<D>
-
Type Parameters
-
D extends OmitIndexSignature<Data>
Parameters
-
name: string
-
ParentError: ErrorConstructor & {
extend?: undefined;
} = Error
-
Optional
options: Options
Creates new custom Error constructor. Use it to create errors to throw.
Typeparam
D - details object interface
Example
Create basic custom error
Example
Create custom error with specified details shape
Example
Create custom error defining parent error to inherit from
Returns