{"id":15743785,"url":"https://github.com/doowb/error-base","last_synced_at":"2025-03-13T10:30:57.446Z","repository":{"id":57141597,"uuid":"42977300","full_name":"doowb/error-base","owner":"doowb","description":"Create custom Error classes.","archived":false,"fork":false,"pushed_at":"2016-02-10T18:23:34.000Z","size":11,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T19:51:45.376Z","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/doowb.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-09-23T03:59:12.000Z","updated_at":"2016-11-20T20:02:33.000Z","dependencies_parsed_at":"2022-09-03T07:40:34.334Z","dependency_job_id":null,"html_url":"https://github.com/doowb/error-base","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Ferror-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Ferror-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Ferror-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Ferror-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/error-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243385872,"owners_count":20282642,"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-04T03:21:23.602Z","updated_at":"2025-03-13T10:30:57.109Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# error-base [![NPM version](https://img.shields.io/npm/v/error-base.svg)](https://www.npmjs.com/package/error-base) [![Build Status](https://img.shields.io/travis/doowb/error-base.svg)](https://travis-ci.org/doowb/error-base)\n\n\u003e Create custom Error classes.\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm i error-base --save\n```\n\n## Usage\n\n```js\nvar errorBase = require('error-base');\n\n// Create a new HelperError that takes additional options.\nvar HelperError = errorBase('HelperError', function (msg, options) {\n  this.message = msg;\n  this.options = options || {};\n});\n\ntry {\n  // Throw a HelperError given the custom arguments\n  throw new HelperError('some error message', {\n    helper: 'helper-name',\n    foo: 'bar'\n  });\n} catch (err) {\n  console.log(err.message);\n  //=\u003e 'some error message'\n\n  console.log(err.options);\n  //=\u003e { helper: 'helper-name', foo: 'bar' }\n}\n```\n\n## API\n\n### [errorBase](index.js#L26)\n\nCode modified from http://stackoverflow.com/a/27925672/914583\n\n**Params**\n\n* `name` **{String}**: Name of new Error Class\n* `init` **{Function}**: Function to call when creating new Error\n* `capture` **{Boolean}**: Optional parameter to determine if the stack trace should be captured or not. (Defaults to `true`)\n* `returns` **{Function}**: new Error Class\n\n**Example**\n\n```js\nvar CustomError = errorBase('CustomError', function (msg) {\n  this.msg = msg;\n});\n```\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d \u0026\u0026 npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/error-base/issues/new).\n\n## Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](http://twitter.com/doowb)\n\n## License\n\nCopyright © 2016 [Brian Woodward](https://github.com/doowb)\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb) on February 10, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Ferror-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Ferror-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Ferror-base/lists"}