{"id":20038500,"url":"https://github.com/yahoo/fumble","last_synced_at":"2026-03-01T20:31:33.488Z","repository":{"id":27774047,"uuid":"31262551","full_name":"yahoo/fumble","owner":"yahoo","description":"Simple error objects in node. Created specifically to be used with https://github.com/yahoo/fetchr and based on https://github.com/hapijs/boom","archived":false,"fork":false,"pushed_at":"2024-02-13T13:30:20.000Z","size":171,"stargazers_count":19,"open_issues_count":2,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-08-04T05:17:28.232Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2015-02-24T14:02:09.000Z","updated_at":"2024-10-25T10:57:28.000Z","dependencies_parsed_at":"2024-06-18T18:22:14.505Z","dependency_job_id":"1b24ef5c-67e3-4258-8ef6-8ffe986c1736","html_url":"https://github.com/yahoo/fumble","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/yahoo/fumble","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Ffumble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Ffumble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Ffumble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Ffumble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoo","download_url":"https://codeload.github.com/yahoo/fumble/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Ffumble/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29983141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":"2024-11-13T10:29:33.779Z","updated_at":"2026-03-01T20:31:28.480Z","avatar_url":"https://github.com/yahoo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fumble\n\n[![npm version](https://badge.fury.io/js/fumble.svg)](http://badge.fury.io/js/fumble)\n![Build Status](https://github.com/yahoo/fumble/actions/workflows/test.yml/badge.svg)\n\n[![Join the chat at https://gitter.im/yahoo/fumble](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yahoo/fumble?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nSimple error objects in node. Created specifically to be used with the [fetchr](https://github.com/yahoo/fetchr) library and based on [hapi.js](http://hapijs.com/)' [Boom](https://github.com/hapijs/boom).\n\n![eli manning](http://media2.giphy.com/media/F9AU77Krzw8ta/giphy.gif)\n\n## Usage\n\n```js\nimport fumble from 'fumble';\nimport callAndProcess from './callAndProcess';\nimport api from 'api';\n\nexport default api.base.service({\n    name: 'foo',\n    read: function (req, resource, params, context, callback) {\n        switch(resource) {\n            case this.name: \n                callAndProcess(req, params, context, callback);\n                return;\n        }\n        \n        const error = fumble.http.create(400, 'Passed in an invalid resource', {\n            debug: [resource]\n        });\n        \n        req.error(error);\n        req.debug(error.stack); // nice stack trace\n        /**\n        * logs:\n        * { [HttpError: Bad Request] statusCode: 400, message: \n        * 'Passed in an invalid resource', debug: [ resource ] }\n        */\n\n        callback(error);\n    }\n});\n```\n\n## API Docs\n\n### fumble.http\n\nprovides a set of utilities for returning HTTP errors. Each method returns an `HttpError` instance, which itself extends the native `Error` class (which means you can access the `stack` prop on your error instance). Each error has the following two props:\n\n* `statusCode` {Number} - the HTTP status code (typically 4xx or 5xx).\n* `message` {String} - the error message\n\n#### `fumble.http.create ([status=500], [message='Internal Server Error'], [options])`\n\nGenerate an `HttpError` object where:\n\n* `statusCode` - an HTTP error code number. Must be greater or equal 400\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nconst error = fumble.http.create(400, 'missing params', { debug: [passedInParams] });\n```\n\n#### HTTP 4xx Errors\n\n##### `fumble.http.badRequest ([message='Bad Request'], [options])`\n\nreturns an HTTP status code of **400**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.badRequest('invalid query');\n\n// essentially generates\n{\n    statusCode: 400,\n    message: 'invalid query'\n}\n```\n\n##### `fumble.http.unauthorized ([message='Unauthorized'], [options])`\n\nreturns an HTTP status code of **401**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.unauthorized('not logged in');\n\n// essentially generates\n{\n    statusCode: 401,\n    message: 'not logged in'\n}\n```\n\n##### `fumble.http.forbidden ([message='Forbidden'], [options])`\n\nreturns an HTTP status code of **403**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.forbidden('top secret');\n\n// essentially generates\n{\n    statusCode: 403,\n    message: 'top secret'\n}\n```\n\n##### `fumble.http.notFound ([message='Not Found'], [options])`\n\nreturns an HTTP status code of **404**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.notFound('does not exist');\n\n// essentially generates\n{\n    statusCode: 404,\n    message: 'does not exist'\n}\n```\n\n##### `fumble.http.methodNotAllowed ([message='Method Not Allowed'], [options])`\n\nreturns an HTTP status code of **405**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.methodNotAllowed('not allowed');\n\n// essentially generates\n{\n    statusCode: 405,\n    message: 'not allowed'\n}\n```\n\n##### `fumble.http.proxyAuthenticationRequired ([message='Proxy Authentication Required'], [options])`\n\nreturns an HTTP status code of **407**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.proxyAuthenticationRequired('need to login to foo');\n\n// essentially generates\n{\n    statusCode: 407,\n    message: 'need to login to foo'\n}\n```\n\n##### `fumble.http.conflict ([message='Conflict'], [options])`\n\nreturns an HTTP status code of **409**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.conflict('collision detected');\n\n// essentially generates\n{\n    statusCode: 409,\n    message: 'collision detected'\n}\n```\n\n##### `fumble.http.gone ([message='Gone'], [options])`\n\nreturns an HTTP status code of **410**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.gone('bye bye');\n\n// essentially generates\n{\n    statusCode: 410,\n    message: 'bye bye'\n}\n```\n\n##### `fumble.http.preconditionFailed ([message='Precondition Failed'], [options])`\n\nreturns an HTTP status code of **412**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.preconditionFailed('missing CLA');\n\n// essentially generates\n{\n    statusCode: 412,\n    message: 'missing CLA'\n}\n```\n\n##### `fumble.http.tooManyRequests ([message='Too Many Requests'], [options])`\n\nreturns an HTTP status code of **429**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.tooManyRequests('slow down');\n\n// essentially generates\n{\n    statusCode: 429,\n    message: 'slow down'\n}\n```\n\n#### HTTP 5xx Errors\n\n##### `fumble.http.internalServerError ([message='Internal Server Error'], [options])`\n\nreturns an HTTP status code of **500**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.internalServerError('unkown error');\n\n// essentially generates\n{\n    statusCode: 500,\n    message: 'unknown error'\n}\n```\n\n===\n\n##### `fumble.http.notImplemented ([message='Not Implemented'], [options])`\n\nreturns an HTTP status code of **501**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.notImplemented('missing enhancement');\n\n// essentially generates\n{\n    statusCode: 501,\n    message: 'missing enhancement'\n}\n```\n\n##### `fumble.http.badGateway ([message='Bad Gateway'], [options])`\n\nreturns an HTTP status code of **502**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.badGateway('mongo error');\n\n// essentially generates\n{\n    statusCode: 502,\n    message: 'mongo error'\n}\n```\n\n##### `fumble.http.serviceUnavailable ([message='Service Unavailable'], [options])\n\nreturns an HTTP status code of **503**\n\n* `message` - optional message string.\n* `options` - extra options\n* `options.debug` - additional error debug info set to `error.debug` property.\n\n```js\nfumble.http.serviceUnavailable('feeds are down');\n\n// essentially generates\n{\n    statusCode: 503,\n    message: 'feeds are down'\n}\n```\n\n## License\n\nThis software is free to use under the Yahoo Inc. BSD license.\nSee the [LICENSE file][] for license text and copyright information.\n\n[LICENSE file]: https://github.com/yahoo/fumble/blob/master/LICENSE.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Ffumble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoo%2Ffumble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Ffumble/lists"}