Glossary Term
Error.isError()
The Error.isError() static method determines whether the passed value is an Error.
Error.isError() checks if the passed value is an Error. It does so by performing a branded check for a private field initialized by the Error() constructor. This is the same mechanism used by Array.isArray(), which is in turn similar to the mechanism used by the in operator.
It is a more robust alternative to instanceof Error because it avoids false positives and false negatives:
Error.isError() rejects values that aren’t actual Error instances, even if they have Error.prototype in their prototype chain — instanceof Error would accept these as it does check the prototype chain. Error.isError() accepts Error objects constructed in another realm — instanceof Error returns false for these because the identity of the Error constructor is different across realms.
Syntax example: Error.isError(value)
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
