{"id":16401076,"url":"https://github.com/flodlc/throw-http","last_synced_at":"2025-02-23T14:18:39.290Z","repository":{"id":225648670,"uuid":"766518005","full_name":"flodlc/throw-http","owner":"flodlc","description":"Throw-http is an Error utility for handling http errors in a delightful way. I created it because existing libraries are not type-safe, not correctly exported or don't allow to pass additional data in the error.","archived":false,"fork":false,"pushed_at":"2024-03-04T09:23:34.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T23:04:14.586Z","etag":null,"topics":["error","http","node"],"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/flodlc.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":"2024-03-03T13:46:11.000Z","updated_at":"2024-03-04T09:21:55.000Z","dependencies_parsed_at":"2024-11-09T16:43:10.935Z","dependency_job_id":null,"html_url":"https://github.com/flodlc/throw-http","commit_stats":null,"previous_names":["flodlc/oops","flodlc/throw-http"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flodlc%2Fthrow-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flodlc%2Fthrow-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flodlc%2Fthrow-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flodlc%2Fthrow-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flodlc","download_url":"https://codeload.github.com/flodlc/throw-http/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240324141,"owners_count":19783464,"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","http","node"],"created_at":"2024-10-11T05:29:21.646Z","updated_at":"2025-02-23T14:18:39.011Z","avatar_url":"https://github.com/flodlc.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003ethrow-http\u003c/h1\u003e\n\n## Introduction\n\nThrow-http is an Error utility for handling http errors in a delightful way.\nI created it because existing libraries are not type-safe, not correctly exported or don't allow to pass additional data in the error.\n\n## Installation\n\nTo get started, install http-throw using npm or yarn:\n\n```sh\nnpm install throw-http\n# or\nyarn add throw-http\n```\n\n## Usage\n\nThrowing an ThrowHttp error\n\n```typescript\nimport { ThrowHttp } from 'throw-http';\n\nthrow new ThrowHttp.NotFound('User not found');\n```\n\nThrowing a custom ThrowHttp error\n\n```typescript\nimport { ThrowHttp } from 'throw-http';\n\nthrow new ThrowHttp({ code: 500, name: 'Badaboom' });\n```\n\nTypeguard for ThrowHttp\n\n```typescript\nimport { ThrowHttp } from 'throw-http';\n\ntry {\n  // some code\n} catch (error) {\n  if (ThrowHttp.isThrowHttp(error)) {\n    // handle http error\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflodlc%2Fthrow-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflodlc%2Fthrow-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflodlc%2Fthrow-http/lists"}