{"id":28274591,"url":"https://github.com/10xengineersqualityprogramming/immediate-error","last_synced_at":"2025-06-16T08:31:24.208Z","repository":{"id":254502221,"uuid":"846687897","full_name":"10xEngineersQualityProgramming/immediate-error","owner":"10xEngineersQualityProgramming","description":"Alternative to throw new Error","archived":false,"fork":false,"pushed_at":"2025-06-09T17:12:00.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T18:24:55.386Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/10xEngineersQualityProgramming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-23T18:31:26.000Z","updated_at":"2025-06-09T17:12:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb9858fc-f9c0-4940-9421-70b1cb434bf4","html_url":"https://github.com/10xEngineersQualityProgramming/immediate-error","commit_stats":null,"previous_names":["tj-commits/immediate-error","10xengineersqualityprogramming/immediate-error"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/10xEngineersQualityProgramming/immediate-error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10xEngineersQualityProgramming%2Fimmediate-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10xEngineersQualityProgramming%2Fimmediate-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10xEngineersQualityProgramming%2Fimmediate-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10xEngineersQualityProgramming%2Fimmediate-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/10xEngineersQualityProgramming","download_url":"https://codeload.github.com/10xEngineersQualityProgramming/immediate-error/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10xEngineersQualityProgramming%2Fimmediate-error/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260126236,"owners_count":22962607,"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":"2025-05-21T02:11:32.816Z","updated_at":"2025-06-16T08:31:24.198Z","avatar_url":"https://github.com/10xEngineersQualityProgramming.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Immediate-error\r\n\r\nThis is a utility to throw an error.\r\n\r\n```javascript\r\n\r\nconst { immediateError, ErrorType } = require('immediate-error')\r\n\r\nimmediateError() // this will throw a regular Error with the default message of \"ERROR!\"\r\n\r\nimmediateError('Aaaaah') // this will throw a regular Error with the message \"Aaaaah\"\r\n\r\nimmediateError('Aaaaah', ErrorType.BaseError) // does the same thing as above\r\n\r\nimmediateError('Aggregate error', ErrorType.AggregateError) // throws an AggregateError\r\n\r\nimmediateError('Assertion error', ErrorType.AssertionError) // throws an AssertionError (from the assert-fn module)\r\n\r\nimmediateError('Assertion error', ErrorType.NativeAssertionError) // throws an AssertionError (from the node:assert module)\r\n\r\nimmediateError('Range error', ErrorType.RangeError) // throws a RangeError\r\n\r\nimmediateError('Reference error', ErrorType.ReferenceError) // throws a ReferenceError\r\n\r\nimmediateError('Syntax error', ErrorType.SyntaxError) // throws a SyntaxError\r\n\r\nimmediateError('type error', ErrorType.TypeError) // throws a TypeError\r\n\r\nclass MyCustomError extends Error {\r\n  constructor (message) {\r\n    super(\"Custom: \" + message)\r\n  }\r\n}\r\n\r\nimmediateError('Error!', MyCustomError) // throws a MyCustomError with the message \"Error!\" which in turn prints out \"Custom: Error!\" because we used our own error class\r\n\r\n```\r\n\r\n## Why?\r\n\r\nThis module is great because it uses the best practices in JavaScript such as using dependencies like [`throw-error`](https://npmjs.com/package/throw-error) and [`yanoop`](https://npmjs.com/package/yanoop) to throw errors and using [`es-errors`](https://npmjs.com/package/es-errors) instead of using the error classes natively.\r\n\r\n## Show your support\r\n\r\n[Follow me on GitHub](https://github.com/tj-commits) and star my repositories.\r\n\r\n## is this a joke?\r\n\r\nOf course not!\r\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\r\n(Yes, it is.)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10xengineersqualityprogramming%2Fimmediate-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F10xengineersqualityprogramming%2Fimmediate-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10xengineersqualityprogramming%2Fimmediate-error/lists"}