Error - JavaScript | MDN
Error objects are thrown when runtime errors occur. The Error object can also be used as a base object for user-defined exceptions. See below for standard built-in error types. Runtime errors result in new Error objects being created and thrown. Besides the generic Error constructor, there are other core error constructors in JavaScript.
https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/error