{"id":27157122,"url":"https://github.com/remscodes/thror","last_synced_at":"2026-03-02T22:31:24.757Z","repository":{"id":186768318,"uuid":"675725981","full_name":"remscodes/thror","owner":"remscodes","description":"🏮 Simple error creation utility","archived":false,"fork":false,"pushed_at":"2024-10-27T19:58:09.000Z","size":494,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T03:19:50.764Z","etag":null,"topics":["error","exception","javascript","typescript"],"latest_commit_sha":null,"homepage":"https://npm.im/thror","language":"TypeScript","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/remscodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-07T15:23:50.000Z","updated_at":"2024-10-27T19:58:13.000Z","dependencies_parsed_at":"2024-08-20T01:12:06.361Z","dependency_job_id":"424ae620-0702-48c4-ab15-090d82549222","html_url":"https://github.com/remscodes/thror","commit_stats":null,"previous_names":["remscodes/thror"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/remscodes/thror","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fthror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fthror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fthror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fthror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remscodes","download_url":"https://codeload.github.com/remscodes/thror/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fthror/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265132251,"owners_count":23716135,"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":["error","exception","javascript","typescript"],"created_at":"2025-04-08T20:53:37.630Z","updated_at":"2026-03-02T22:31:19.729Z","avatar_url":"https://github.com/remscodes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003eThror\u003c/h1\u003e\n    \u003cp\u003eSimple error creation utility\u003c/p\u003e\n\u003c/div\u003e \n\n\u003cdiv align=\"center\"\u003e\n\n[![github ci](https://img.shields.io/github/actions/workflow/status/remscodes/thror/npm-ci.yml.svg?logo=github\u0026label=CI\u0026style=for-the-badge)](https://github.com/remscodes/thror/actions/workflows/npm-ci.yml)\n[![codecov coverage](https://img.shields.io/codecov/c/github/remscodes/thror/main.svg?style=for-the-badge\u0026logo=codecov)](https://codecov.io/gh/remscodes/thror)\n[![npm version](https://img.shields.io/npm/v/thror.svg?style=for-the-badge\u0026logo=npm)](https://www.npmjs.org/package/thror)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/thror.svg?style=for-the-badge)](https://bundlephobia.com/package/thror)\n[![license](https://img.shields.io/github/license/remscodes/thror.svg?style=for-the-badge)](LICENSE)\n\n\u003c/div\u003e\n\n## Installation\n\n```shell\nnpm install thror\n```\n\n## Usage\n\n### Create Error\n\n##### createError(name, message, extra?)\n\nExample :\n\n```ts\nimport { createError } from 'thror';\n\nconst err = createError('MyException', 'Cannot create user without username.', { status: 400 });\n\nconsole.log(err.name); // MyException\nconsole.log(err.message); // Cannot create user without username.\nconsole.log(err.status); // 400 \nconsole.log(err instanceof Error) // true\n\nthrow err; // [MyException: Cannot create user without username.] { status: 400 }\n```\n\n### Emit Error\n\n##### emitError(name, message, extra?)\n\nExample :\n\n```ts\nimport { emitError } from 'thror';\n\n// will immediately throw the created error \nemitError('MyException', 'Cannot create user without username.', { status: 400 }) // [MyException: Cannot create user without username.] { status: 400 }\n```\n\n### Extra\n\n```ts\ninterface ErrorExtra {\n  // Preserves the error stack.\n  // default : false\n  withStack?: boolean;\n\n  // The original error.\n  // For example in the case you want to display a clearer error with Thror and store the original one.\n  original?: any;\n\n  // Whatever you want.\n  [key: string]: any;\n}\n```\n\n## License\n[MIT](LICENSE) © Rémy Abitbol.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremscodes%2Fthror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremscodes%2Fthror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremscodes%2Fthror/lists"}