Custom error class for handling HTTP request errors.
The error message.
The HTTP status code associated with the error.
Additional data related to the error.
try { // Some code that may throw an error} catch (error) { throw new CustomError('Failed to fetch resource', 500, error);} Copy
try { // Some code that may throw an error} catch (error) { throw new CustomError('Failed to fetch resource', 500, error);}
Optional
Readonly
Static
Optional override for formatting stack traces
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Create .stack property on a target object
Custom error class for handling HTTP request errors.
Param: status
The HTTP status code associated with the error.
Param: data
Additional data related to the error.
Example