{"id":20780134,"url":"https://github.com/xotic750/error-x","last_synced_at":"2025-04-30T20:08:27.528Z","repository":{"id":2471746,"uuid":"46626639","full_name":"Xotic750/error-x","owner":"Xotic750","description":"Create custom Javascript Error objects.","archived":false,"fork":false,"pushed_at":"2023-01-04T23:03:35.000Z","size":7287,"stargazers_count":3,"open_issues_count":21,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T20:08:21.937Z","etag":null,"topics":["browser","ecmascript","error","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xotic750.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-21T17:55:10.000Z","updated_at":"2020-01-31T11:47:19.000Z","dependencies_parsed_at":"2023-01-13T11:53:10.355Z","dependency_job_id":null,"html_url":"https://github.com/Xotic750/error-x","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Ferror-x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Ferror-x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Ferror-x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xotic750%2Ferror-x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xotic750","download_url":"https://codeload.github.com/Xotic750/error-x/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251774896,"owners_count":21641731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","ecmascript","error","nodejs"],"created_at":"2024-11-17T13:32:27.983Z","updated_at":"2025-04-30T20:08:27.507Z","avatar_url":"https://github.com/Xotic750.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca\n  href=\"https://travis-ci.org/Xotic750/error-x\"\n  title=\"Travis status\"\u003e\n\u003cimg\n  src=\"https://travis-ci.org/Xotic750/error-x.svg?branch=master\"\n  alt=\"Travis status\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://david-dm.org/Xotic750/error-x\"\n  title=\"Dependency status\"\u003e\n\u003cimg src=\"https://david-dm.org/Xotic750/error-x/status.svg\"\n  alt=\"Dependency status\" height=\"18\"/\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://david-dm.org/Xotic750/error-x?type=dev\"\n  title=\"devDependency status\"\u003e\n\u003cimg src=\"https://david-dm.org/Xotic750/error-x/dev-status.svg\"\n  alt=\"devDependency status\" height=\"18\"/\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://badge.fury.io/js/error-x\"\n  title=\"npm version\"\u003e\n\u003cimg src=\"https://badge.fury.io/js/error-x.svg\"\n  alt=\"npm version\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://www.jsdelivr.com/package/npm/error-x\"\n  title=\"jsDelivr hits\"\u003e\n\u003cimg src=\"https://data.jsdelivr.com/v1/package/npm/error-x/badge?style=rounded\"\n  alt=\"jsDelivr hits\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://bettercodehub.com/results/Xotic750/error-x\"\n  title=\"bettercodehub score\"\u003e\n\u003cimg src=\"https://bettercodehub.com/edge/badge/Xotic750/error-x?branch=master\"\n  alt=\"bettercodehub score\" height=\"18\"\u003e\n\u003c/a\u003e\n\u003ca\n  href=\"https://coveralls.io/github/Xotic750/error-x?branch=master\"\n  title=\"Coverage Status\"\u003e\n\u003cimg src=\"https://coveralls.io/repos/github/Xotic750/error-x/badge.svg?branch=master\"\n  alt=\"Coverage Status\" height=\"18\"\u003e\n\u003c/a\u003e\n\n\u003ca name=\"module_error-x\"\u003e\u003c/a\u003e\n\n## error-x\n\nCreate custom Javascript Error objects.\n\n- [error-x](#module_error-x)\n  - [`module.exports`](#exp_module_error-x--module.exports) ⏏\n    - [.AssertionErrorConstructor](#module_error-x--module.exports.AssertionErrorConstructor) ⇐ \u003ccode\u003eError\u003c/code\u003e\n      - [`new AssertionErrorConstructor([message])`](#new_module_error-x--module.exports.AssertionErrorConstructor_new)\n    - [.ErrorConstructor](#module_error-x--module.exports.ErrorConstructor) ⇐ \u003ccode\u003eError\u003c/code\u003e\n      - [`new ErrorConstructor([message])`](#new_module_error-x--module.exports.ErrorConstructor_new)\n    - [.EvalErrorConstructor](#module_error-x--module.exports.EvalErrorConstructor) ⇐ \u003ccode\u003eEvalError\u003c/code\u003e\n      - [`new EvalErrorConstructor([message])`](#new_module_error-x--module.exports.EvalErrorConstructor_new)\n    - [.InternalErrorConstructor](#module_error-x--module.exports.InternalErrorConstructor) ⇐ \u003ccode\u003eError\u003c/code\u003e\n      - [`new InternalErrorConstructor([message])`](#new_module_error-x--module.exports.InternalErrorConstructor_new)\n    - [.RangeErrorConstructor](#module_error-x--module.exports.RangeErrorConstructor) ⇐ \u003ccode\u003eRangeError\u003c/code\u003e\n      - [`new RangeErrorConstructor()`](#new_module_error-x--module.exports.RangeErrorConstructor_new)\n    - [.ReferenceErrorConstructor](#module_error-x--module.exports.ReferenceErrorConstructor) ⇐ \u003ccode\u003eReferenceError\u003c/code\u003e\n      - [`new ReferenceErrorConstructor([message])`](#new_module_error-x--module.exports.ReferenceErrorConstructor_new)\n    - [.SyntaxErrorConstructor](#module_error-x--module.exports.SyntaxErrorConstructor) ⇐ \u003ccode\u003eSyntaError\u003c/code\u003e\n      - [`new SyntaxErrorConstructor([message])`](#new_module_error-x--module.exports.SyntaxErrorConstructor_new)\n    - [.TypeErrorConstructor](#module_error-x--module.exports.TypeErrorConstructor) ⇐ \u003ccode\u003eTypeError\u003c/code\u003e\n      - [`new TypeErrorConstructor([message])`](#new_module_error-x--module.exports.TypeErrorConstructor_new)\n    - [.URIErrorConstructor](#module_error-x--module.exports.URIErrorConstructor) ⇐ \u003ccode\u003eURIError\u003c/code\u003e\n      - [`new URIErrorConstructor([message])`](#new_module_error-x--module.exports.URIErrorConstructor_new)\n    - [`.supportsAllConstructors`](#module_error-x--module.exports.supportsAllConstructors) : \u003ccode\u003eboolean\u003c/code\u003e\n    - [`.create([name], [ECTR])`](#module_error-x--module.exports.create) ⇒ \u003ccode\u003efunction\u003c/code\u003e\n    - [`.isErrorConstructor(value)`](#module_error-x--module.exports.isErrorConstructor) ⇒ \u003ccode\u003eboolean\u003c/code\u003e\n\n\u003ca name=\"exp_module_error-x--module.exports\"\u003e\u003c/a\u003e\n\n### `module.exports` ⏏\n\nWant to create your own Error objects, this module will allow you to do\njust that. It ships with all the standard ErrorConstructor objects already created\nfor you. Why? Well, these offer some improvements over the native versions.\n\n- They have a `toJSON` method and so they can be serialised.\n- They have a standardised `stack` property, using\n  [`error-stack-parser`](https://github.com/stacktracejs/error-stack-parser)\n  messages and stacks are parsed and then re-formatted.\n- They have a `frames` property which is an array of the parsed `stack`\n  message, so you have easy access to the information.\n\n**Kind**: Exported member  \n\u003ca name=\"module_error-x--module.exports.AssertionErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.AssertionErrorConstructor ⇐ \u003ccode\u003eError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.AssertionErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new AssertionErrorConstructor_new([message])`\n\nError constructor for test and validation frameworks that implement the\nstandardized AssertionError specification.\n\n| Param     | Type                | Description                      |\n| --------- | ------------------- | -------------------------------- |\n| [message] | \u003ccode\u003eObject\u003c/code\u003e | Need to document the properties. |\n\n\u003ca name=\"module_error-x--module.exports.ErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.ErrorConstructor ⇐ \u003ccode\u003eError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.ErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new ErrorConstructor([message])`\n\nThe Error constructor creates an error object.\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.EvalErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.EvalErrorConstructor ⇐ \u003ccode\u003eEvalError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eEvalError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.EvalErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new EvalErrorConstructor_new([message])`\n\nCreates an instance representing an error that occurs regarding the\nglobal function eval().\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.InternalErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.InternalErrorConstructor ⇐ \u003ccode\u003eError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.InternalErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new InternalErrorConstructor_new([message])`\n\nThe InternalError object indicates an error that occurred internally in\nthe JavaScript engine. For example: \"InternalErrorConstructor: too much recursion\".\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.RangeErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.RangeErrorConstructor ⇐ \u003ccode\u003eRangeError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eRangeError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.RangeErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new RangeErrorConstructor_new()`\n\nCreates an instance representing an error that occurs when a numeric\nvariable or parameter is outside of its valid range.\n\n| Type                | Description                                        |\n| ------------------- | -------------------------------------------------- |\n| \u003ccode\u003estring\u003c/code\u003e | [message] Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.ReferenceErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.ReferenceErrorConstructor ⇐ \u003ccode\u003eReferenceError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eReferenceError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.ReferenceErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new ReferenceErrorConstructor_new([message])`\n\nCreates an instance representing an error that occurs when de-referencing\nan invalid reference\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.SyntaxErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.SyntaxErrorConstructor ⇐ \u003ccode\u003eSyntaError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eSyntaError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.SyntaxErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new SyntaxErrorConstructor([message])`\n\nCreates an instance representing a syntax error that occurs while parsing\ncode in eval().\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.TypeErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.TypeErrorConstructor ⇐ \u003ccode\u003eTypeError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eTypeError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.TypeErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new TypeErrorConstructor([message])`\n\nCreates an instance representing an error that occurs when a variable or\nparameter is not of a valid type.\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.URIErrorConstructor\"\u003e\u003c/a\u003e\n\n#### module.exports.URIErrorConstructor ⇐ \u003ccode\u003eURIError\u003c/code\u003e\n\n**Kind**: static class of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Extends**: \u003ccode\u003eURIError\u003c/code\u003e  \n\u003ca name=\"new_module_error-x--module.exports.URIErrorConstructor_new\"\u003e\u003c/a\u003e\n\n##### `new URIErrorConstructor([message])`\n\nCreates an instance representing an error that occurs when encodeURI() or\ndecodeURI() are passed invalid parameters.\n\n| Param     | Type                | Description                              |\n| --------- | ------------------- | ---------------------------------------- |\n| [message] | \u003ccode\u003estring\u003c/code\u003e | Human-readable description of the error. |\n\n\u003ca name=\"module_error-x--module.exports.supportsAllConstructors\"\u003e\u003c/a\u003e\n\n#### `module.exports.supportsAllConstructors` : \u003ccode\u003eboolean\u003c/code\u003e\n\nIndicates if the Javascript engine supports subclassing of all Error\ntypes. If `true` then all are supported, if `false` (only very old\nbrowsers IE6) then only `Error` is supported.\n\n**Kind**: static property of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n\u003ca name=\"module_error-x--module.exports.create\"\u003e\u003c/a\u003e\n\n#### `module.exports.create([name], [ECTR])` ⇒ \u003ccode\u003efunction\u003c/code\u003e\n\nCreates a custom Error constructor. Will use `ErrorConstructor` if argument is not\na valid constructor.\n\n**Kind**: static method of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Returns**: \u003ccode\u003efunction\u003c/code\u003e - The custom Error constructor.\n\n| Param  | Type                  | Default                                    | Description                    |\n| ------ | --------------------- | ------------------------------------------ | ------------------------------ |\n| [name] | \u003ccode\u003estring\u003c/code\u003e   | \u003ccode\u003e\u0026quot;\u0026#x27;Error\u0026#x27;\u0026quot;\u003c/code\u003e | The name for the custom Error. |\n| [ECTR] | \u003ccode\u003efunction\u003c/code\u003e | \u003ccode\u003eError\u003c/code\u003e                         | Error constructor to be used.  |\n\n**Example**\n\n```js\nimport * as errorX from 'error-x';\n\nconst MyError = errorX.create('MyError'); // Uses `Error` as no constructor\n// specified.\nconst err = new MyError('somethingHappened');\n\nJSON.stringify(err); // =\u003e see below.\n// A serialised error, showing the custom error object's structure and\n// format\n// {\n//   \"name\": \"MyError\",\n//   \"message\": \"somethingHappened\",\n//   \"frames\": [\n//     {\n//       \"functionName\": \"Y.x\",\n//       \"fileName\": \"http://fiddle.jshell.net/2k5x5dj8/183/show/\",\n//       \"lineNumber\": 65,\n//       \"columnNumber\": 13,\n//       \"source\": \"Y.x (http://fiddle.jshell.net/2k5x5dj8/183/show/:65:13)\"\n//     },\n//     {\n//       \"functionName\": \"window.onload\",\n//       \"fileName\": \"http://fiddle.jshell.net/2k5x5dj8/183/show/\",\n//       \"lineNumber\": 73,\n//       \"columnNumber\": 3,\n//       \"source\": \"window.onload (http://fiddle.jshell.net/2k5x5dj8/183/show/:73:3)\"\n//     }\n//   ],\n//   \"stack\": \"MyError\\n    Y.x()@http://fiddle.jshell.net/2k5x5dj8/183/show/:65:13\\n    window.onload()@http://fiddle.jshell.net/2k5x5dj8/183/show/:73:3\"\n// }\n```\n\n\u003ca name=\"module_error-x--module.exports.isErrorConstructor\"\u003e\u003c/a\u003e\n\n#### `module.exports.isErrorConstructor(value)` ⇒ \u003ccode\u003eboolean\u003c/code\u003e\n\nDetermine whether or not a given `value` is an `Error` type.\n\n**Kind**: static method of [\u003ccode\u003emodule.exports\u003c/code\u003e](#exp_module_error-x--module.exports)  \n**Returns**: \u003ccode\u003eboolean\u003c/code\u003e - Returns `true` if `value` is an `Error` type,\nelse `false`.\n\n| Param | Type            | Description              |\n| ----- | --------------- | ------------------------ |\n| value | \u003ccode\u003e\\*\u003c/code\u003e | The object to be tested. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxotic750%2Ferror-x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxotic750%2Ferror-x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxotic750%2Ferror-x/lists"}