Spaces:
Running
Running
File size: 472 Bytes
d4b85c0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/**
* Determines if the given value is shaped like a Node.js exception.
* Node.js exceptions have additional information, like
* the `code` and `errno` properties.
*
* In some environments, particularly jsdom/jest these may not
* instances of `Error` or its subclasses, despite being similar
* to them.
*/
export function isNodeExceptionLike(
error: unknown,
): error is NodeJS.ErrnoException {
return !!error && typeof error === 'object' && 'code' in error
}
|