Skip to content
Discussion options

You must be logged in to vote

Possible errors:

  • HTTPError: Ky error, non-2xx with error.response;
  • TimeoutError: Ky timeout;
  • AbortError: user-abort (AbortController);
  • TypeError: network failures. (related: #545)

Whether instanceof or .name depends on your preference. .name has the benefit of working across realms.


What are realms:

A JS realm is an isolated execution environment. Each realm has its own global object, global scope, built-ins (Array, Object, etc.), and prototype chains. Different realms don’t share identity for built-ins (Array from one realm !== Array from another), but they can exchange objects if references cross realms (e.g. iframes, Workers).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants