{"id":37676323,"url":"https://github.com/internap/base-http-errors","last_synced_at":"2026-01-16T12:14:31.665Z","repository":{"id":57118941,"uuid":"86715276","full_name":"internap/base-http-errors","owner":"internap","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-20T17:24:49.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-08-27T16:36:47.447Z","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/internap.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}},"created_at":"2017-03-30T14:56:23.000Z","updated_at":"2017-03-30T14:59:20.000Z","dependencies_parsed_at":"2022-08-22T22:20:37.655Z","dependency_job_id":null,"html_url":"https://github.com/internap/base-http-errors","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/internap/base-http-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internap%2Fbase-http-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internap%2Fbase-http-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internap%2Fbase-http-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internap%2Fbase-http-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/internap","download_url":"https://codeload.github.com/internap/base-http-errors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/internap%2Fbase-http-errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-16T12:14:30.854Z","updated_at":"2026-01-16T12:14:31.659Z","avatar_url":"https://github.com/internap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Base HTTP Errors\n\nA set of basic HTTP errors that can be used in Express.js\n\n## Usage\n\n```javascript\nconst {\n    NotFound,\n    BadRequest\n} = require('base-http-errors');\n\napp.use((req, res, next) =\u003e {\n    if (routeDoesntExist()) {\n        next(new NotFound());\n    }\n    \n    if (somethingWrongWithRequest()) {\n        next(new BadRequest('A Custom Message'));\n    }\n});\n\n\n// error handler\napp.use((err, req, res, next) =\u003e {\n    res.status(err.status);\n    res.json({\n        message: err.message,\n        type: err.constructor.name,\n    });\n});\n\n```\n\n## Available Errors\n\n| Error Class       | Default Message    | Status Code  |\n| ----------------- | ------------------ | ------------ |\n| BaseError         | Base Error         | 500          |\n| TooManyRequests   | Too Many Requests  | 429          |\n| NotFound          | Not Found          | 404          |\n| Unauthorized      | Unauthorized       | 401          |\n| Forbidden         | Forbidden          | 403          |\n| BadRequest        | Bad Request        | 400          |\n| InvalidInput      | Invalid Input      | 400          |\n\n\n## Custom Errors\n\nYou may subclass any of the above listed errors to create your own error.\n\nE.g.\n\n```javascript\nclass CustomError extends BaseError {\n    constructor(message) {\n        super(message || 'Custom Error');\n        this.status = 400;\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finternap%2Fbase-http-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finternap%2Fbase-http-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finternap%2Fbase-http-errors/lists"}