{"id":15456547,"url":"https://github.com/tabcat/code-err","last_synced_at":"2025-10-16T15:07:19.022Z","repository":{"id":63246196,"uuid":"546137212","full_name":"tabcat/code-err","owner":"tabcat","description":"create error instances with a code (and props)","archived":false,"fork":false,"pushed_at":"2024-05-21T03:33:50.000Z","size":373,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-12T12:21:04.174Z","etag":null,"topics":["err-code","error","error-handling"],"latest_commit_sha":null,"homepage":"","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/tabcat.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-05T15:33:26.000Z","updated_at":"2024-05-21T03:33:54.000Z","dependencies_parsed_at":"2024-10-26T16:54:22.680Z","dependency_job_id":"96f65b81-1750-4d04-a936-bc1c1ae32450","html_url":"https://github.com/tabcat/code-err","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":"0.014705882352941124","last_synced_commit":"3f3c2b391a0d6b551f94d1f585941c8581d139a6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabcat%2Fcode-err","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabcat%2Fcode-err/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabcat%2Fcode-err/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabcat%2Fcode-err/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tabcat","download_url":"https://codeload.github.com/tabcat/code-err/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243277488,"owners_count":20265350,"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":["err-code","error","error-handling"],"created_at":"2024-10-01T22:33:03.056Z","updated_at":"2025-10-16T15:07:13.957Z","avatar_url":"https://github.com/tabcat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/code-err?color=darkred\u0026style=flat-square)](https://www.npmjs.com/package/code-err)\n\n# code-err \n\n\u003e create error instances with a code (and props)\u003cbr/\u003e\n\u003e a more intuitive [err-code](https://github.com/IndigoUnited/js-err-code)\u003cbr/\u003e\n\n## Description\n\nExtends the builtin Error class with `.code` and `.props` properties for better error handling.\n\n## Install\n\n### npm:\n\n`npm install code-err`\n\n## Import\n\n### ESM\n\n`import { CodeError } from 'code-err'`\n\n\u003c!--\n### CJS\n\n`const { CodeError } = require('code-err')`\n--\u003e\n\n## Usage\n\n```ts\nconst message = 'this is an error message'\nconst code = 'THIS_IS_AN_ERROR_CODE'\ninterface Props { ... }\nconst props: Props = { ... }\n\n// typescript without props\nnew CodeError(message, { code })\n\n// typescript with props\nnew CodeError\u003cProps\u003e(message, { code, props })\n\n// javascript\nnew CodeError(message, { code, props })\n```\n\n## API\n\n### CodeError Class\n\n#### constructor\u003cbr/\u003e\u0026emsp; \\\u003cT extends Record\\\u003cstring, any\\\u003e\\\u003e\u003cbr/\u003e\u0026emsp; (message?: string, options?: { code?: string, props?: T, name?: string, cause?: unknown })\n\n### CodeError Instance\n\n#### `readonly` message: string\n\nThe error message provided to the constructor\n\n*default value*: `''`\n\n#### `readonly` code: string\n\nThe error code provided to the constructor\n\n*default value*: `''`\n\n#### `readonly` props: T\n\nThe error props provided to the constructor\n\n*default value*: `{}`\n\n#### `readonly` name: string\n\nThe error name provided to the constructor\n\n*default value*: `'CodeError'`\n\n#### `readonly` cause: unknown\n\nThe error cause provided to the constructor.\n\n*default value*: `undefined`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabcat%2Fcode-err","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftabcat%2Fcode-err","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabcat%2Fcode-err/lists"}