ctrl+k
Enter a search term above to see results...
Enter a search term above to see results...
The Error utilities provide functions for enhanced error handling and throwing in JavaScript.
Throws an error with enhanced control over the error type, metadata, and stack trace.
Asynchronous Error Throwing This function uses
queueMicrotask
to throw the error asynchronously, allowing the current execution context to complete.
Name | Type | Description |
---|---|---|
message | string | The error message |
options | object | Optional configuration |
Name | Type | Default | Description |
---|---|---|---|
errorType | function | Error | The type of error to throw |
metadata | object | Additional data to attach to the error | |
onError | function | null | Callback to execute before throwing the error |
removeStackLines | number | 1 | Number of stack trace lines to remove |