{"id":17766630,"url":"https://github.com/floatdrop/create-error-class","last_synced_at":"2025-04-07T16:18:43.937Z","repository":{"id":35132265,"uuid":"39338674","full_name":"floatdrop/create-error-class","owner":"floatdrop","description":"Create Error classes","archived":false,"fork":false,"pushed_at":"2018-11-27T16:33:48.000Z","size":12,"stargazers_count":42,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T14:13:01.738Z","etag":null,"topics":[],"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/floatdrop.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-07-19T15:33:02.000Z","updated_at":"2021-09-24T20:47:59.000Z","dependencies_parsed_at":"2022-08-17T21:25:43.963Z","dependency_job_id":null,"html_url":"https://github.com/floatdrop/create-error-class","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fcreate-error-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fcreate-error-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fcreate-error-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floatdrop%2Fcreate-error-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floatdrop","download_url":"https://codeload.github.com/floatdrop/create-error-class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685628,"owners_count":20979085,"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":[],"created_at":"2024-10-26T20:33:32.669Z","updated_at":"2025-04-07T16:18:43.917Z","avatar_url":"https://github.com/floatdrop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# create-error-class [![Build Status](https://travis-ci.org/floatdrop/create-error-class.svg?branch=master)](https://travis-ci.org/floatdrop/create-error-class)\n\n\u003e Create error class\n\n\n## Install\n\n```\n$ npm install --save create-error-class\n```\n\n\n## Usage\n\n```js\nvar createErrorClass = require('create-error-class');\n\nvar HTTPError = createErrorClass('HTTPError', function (props) {\n\tthis.message = 'Status code is ' + props.statusCode;\n});\n\nthrow new HTTPError({statusCode: 404});\n```\n\n\n## API\n\n### createErrorClass(className, [setup])\n\nReturn constructor of Errors with `className`.\n\n#### className\n\n*Required*  \nType: `string`\n\nClass name of Error Object. Should contain characters from `[0-9a-zA-Z_$]` range.\n\n#### setup\nType: `function`\n\nSetup function, that will be called after each Error object is created from constructor with context of Error object.\n\nBy default `setup` function sets `this.message` as first argument:\n\n```js\nvar MyError = createErrorClass('MyError');\n\nnew MyError('Something gone wrong!').message; // =\u003e 'Something gone wrong!'\n```\n\n## License\n\nMIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fcreate-error-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloatdrop%2Fcreate-error-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloatdrop%2Fcreate-error-class/lists"}