{"id":20426530,"url":"https://github.com/futurestudio/hapi-dev-errors","last_synced_at":"2025-05-07T04:05:59.820Z","repository":{"id":34186512,"uuid":"94319540","full_name":"futurestudio/hapi-dev-errors","owner":"futurestudio","description":"A hapi plugin to return better error details and skip the look at command line to catch the issue.","archived":false,"fork":false,"pushed_at":"2025-05-06T03:48:50.000Z","size":1897,"stargazers_count":59,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T04:05:50.441Z","etag":null,"topics":["developer-tools","development","error-reporting","error-stacktrace","future-studio-university","hapi","hapi-plugin","node","nodejs","productivity","youch"],"latest_commit_sha":null,"homepage":"","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/futurestudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-06-14T10:34:36.000Z","updated_at":"2025-03-28T03:59:57.000Z","dependencies_parsed_at":"2023-07-16T17:00:34.974Z","dependency_job_id":"f7e80234-63e9-465e-a1c3-48bbffb6a927","html_url":"https://github.com/futurestudio/hapi-dev-errors","commit_stats":{"total_commits":376,"total_committers":11,"mean_commits":34.18181818181818,"dds":"0.42553191489361697","last_synced_commit":"7e1f36f95b478cbd4d3de7986a4463927e825466"},"previous_names":["fs-opensource/hapi-dev-errors"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futurestudio%2Fhapi-dev-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futurestudio%2Fhapi-dev-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futurestudio%2Fhapi-dev-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/futurestudio%2Fhapi-dev-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/futurestudio","download_url":"https://codeload.github.com/futurestudio/hapi-dev-errors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810273,"owners_count":21807759,"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":["developer-tools","development","error-reporting","error-stacktrace","future-studio-university","hapi","hapi-plugin","node","nodejs","productivity","youch"],"created_at":"2024-11-15T07:16:50.280Z","updated_at":"2025-05-07T04:05:59.799Z","avatar_url":"https://github.com/futurestudio.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"471\" style=\"max-width:100%;\" src=\"https://github.com/futurestudio/hapi-dev-errors/blob/master/media/hapi-dev-errors.png?raw=true\" alt=\"hapi-dev-errors logo\"\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    A hapi plugin to show server errors in the browser or terminal.\n  \u003c/p\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    \u003ca href=\"#installation\"\u003e\u003cstrong\u003eInstallation\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#usage\"\u003e\u003cstrong\u003eUsage\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#plugin-registration-options\"\u003e\u003cstrong\u003ePlugin Options\u003c/strong\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://travis-ci.org/futurestudio/hapi-dev-errors\"\u003e\u003cimg src=\"https://travis-ci.org/futurestudio/hapi-dev-errors.svg?branch=master\" alt=\"Build Status\" data-canonical-src=\"https://travis-ci.org/futurestudio/hapi-dev-errors.svg?branch=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://snyk.io/test/github/futurestudio/hapi-dev-errors\"\u003e\u003cimg src=\"https://snyk.io/test/github/futurestudio/hapi-dev-errors/badge.svg\" alt=\"Known Vulnerabilities\" data-canonical-src=\"https://snyk.io/test/github/futurestudio/hapi-dev-errors\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/hapi-dev-errors\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/hapi-dev-errors.svg\" alt=\"Latest Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/hapi-dev-errors\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/hapi-dev-errors.svg\" alt=\"Monthly downloads\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\n    \u003cem\u003eFollow \u003ca href=\"http://twitter.com/marcuspoehls\"\u003e@marcuspoehls\u003c/a\u003e for updates!\u003c/em\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n------\n\n\u003cp align=\"center\"\u003e\u003csup\u003eDevelopment of this hapi plugin is supported by \u003ca href=\"https://futurestud.io\"\u003eFuture Studio University 🚀\u003c/a\u003e\u003c/sup\u003e\n\u003cbr\u003e\u003cb\u003e\nJoin the \u003ca href=\"https://futurestud.io/university\"\u003eFuture Studio University and Skyrocket in Node.js\u003c/a\u003e\u003c/b\u003e\n\u003c/p\u003e\n\n------\n\n\n## Introduction\nA hapi plugin to return an error view for web requests, providing more details of the issue. `hapi-dev-errors` will give you the exact file where the error happend and a nice error stacktrace within the browser. Skip the extra look at your command line to catch the issue's location.\n\n![hapi-dev-errors default error Youch error view](media/hapi-dev-errors-default-youch-view.png)\n\n`hapi-dev-errors` seamlessly integrates [Youch](https://github.com/poppinss/youch) to show the error details.\n\nBesides the web view, `hapi-dev-errors` prints pretty error details to the terminal. This is nice when running your hapi server as an API. Printing error details to the console is enabled by default. To disable the terminal error, use the [`toTerminal: false` option](https://github.com/futurestudio/hapi-dev-errors#plugin-registration-options).\n\n![hapi-dev-errors pretty terminal error](media/hapi-dev-errors-on-terminal.png)\n\n\n## Requirements\nThis plugin uses async/await which requires **Node.js v12 or newer**.\n\n\n### Compatibility\n| Major Release | [hapi.js](https://github.com/hapijs/hapi) version | Node.js version |\n| --- | --- | --- |\n| `v4` | `\u003e=17 hapi` | `\u003e=12` |\n| `v3` | `\u003e=17 hapi` | `\u003e=8` |\n| `v2` | `\u003e=17 hapi` | `\u003e=8` |\n\n\n## Installation\nAdd `hapi-dev-errors` as a dependency to your project:\n\n```bash\nnpm i hapi-dev-errors\n```\n\n\n### Using hapi v17 or v18?\nUse the `3.x` release of `hapi-dev-errors`:\n\n```bash\nnpm i hapi-dev-errors@3\n```\n\n### Using hapi v16 (or lower)?\nUse the `1.3.2` release of `hapi-dev-errors` with hapi v16. Later versions are only compatible with hapi v17.\n\n```bash\nnpm i hapi-dev-errors@1.3.2\n```\n\n\n## Examples\nCheck out the [examples](https://github.com/futurestudio/hapi-dev-errors/tree/master/examples) directory and get\nan impression on how to configure `hapi-dev-errors` with the individual plugins options and how to customize the\nerror view.\n\n## Usage\n**`hapi-dev-errors` is disabled by default to avoid leaking sensitive error details during production.**\n\nEnable the plugin by define a \"truthy\" value for the `showErrors` option.\n\nThe most straight forward way to register the `hapi-dev-errors` plugin:\n\n```js\nawait server.register({\n    plugin: require('hapi-dev-errors'),\n    options: {\n      showErrors: process.env.NODE_ENV !== 'production'\n    }\n})\n\n// went smooth like chocolate :)\n```\n\n\n## Plugin Registration Options\nThe following plugin options allow you to customize the default behavior of `hapi-dev-errors`:\n\n- **showErrors**: `(boolean)`, default: `false` — by default, the plugin is disabled and keeps hapi's default error handling behavior\n- **template**: `(string)`, no default — provide the template name that you want to render with `h.view(template, errorData)`\n- **toTerminal**: `(boolean)`, default: `true` — print pretty errors to the terminal as well (enabled by default)\n- **links**: `(array)` - default: linked SVG icons for Google and Stack Overflow - an array of callback functions that accept the error as a parameter. The callback functions should return the link to render below the error message. Pass an empty array `[]` to disable the default links\n\n```js\nawait server.register({\n    plugin: require('hapi-dev-errors'),\n    options: {\n        showErrors: process.env.NODE_ENV !== 'production',\n        template: 'my-error-view',\n        toTerminal: true,\n        links: [ (error) =\u003e {\n          return `\n            \u003ca href=\"https://github.com/futurestudio/hapi-dev-errors/search?q=${error.message}\"\u003e\n              Search hapi-dev-errors on GitHub\n            \u003c/a\u003e\n          `\n        }\n      ]\n    }\n})\n\n// went smooth like chocolate :)\n```\n\n\n## Provided Values for Your Custom Error View\n`hapi-dev-errors` supports the `template` option while registering the plugin. Provide a template name to\nuse your personal error template and not the default one shipped with `hapi-dev-errors`. In case you pass a string\nvalue for the template name, the view will be rendered with `h.view(template, errorData).code(500)`.\n\nAvailable properties to use in your custom error view:\n\n- `request`: the request that caused the error\n- `error`: the error response with all its properties\n- `title`: error title like `Internal Server Error`\n- `statusCode`: HTTP response status code (always 500)\n- `message`: error message, like `Uncaught error: h.view(...).test is not a function`\n- `method`: HTTP request method, like `GET`\n- `url`: URL request path, like `/signup`\n- `headers`: HTTP request headers object, in key-value format\n- `payload`: HTTP request payload, only available for HTTP methods other than `GET`, in key-value format\n- `stacktrace`: error stacktrace\n\n\n## Feature Requests\nDo you miss a feature? Please don’t hesitate to\n[create an issue](https://github.com/futurestudio/hapi-dev-errors/issues) with a short description of your\ndesired addition to this plugin.\n\n\n## Links \u0026 Resources\n\n- [hapi tutorial series](https://futurestud.io/tutorials/hapi-get-your-server-up-and-running) with 100+ tutorials\n- [Youch](https://github.com/poppinss/youch) - Pretty error reporting for Node.js\n- [Youch terminal](https://github.com/poppinss/youch-terminal) - Pretty error reporting on your terminal\n\n\n## Contributing\n\n1.  Create a fork\n2.  Create your feature branch: `git checkout -b my-feature`\n3.  Commit your changes: `git commit -am 'Add some feature'`\n4.  Push to the branch: `git push origin my-new-feature`\n5.  Submit a pull request 🚀\n\n\n## License\n\nMIT © [Future Studio](https://futurestud.io)\n\n---\n\n\u003e [futurestud.io](https://futurestud.io) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@futurestudio](https://github.com/futurestudio/) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter [@futurestud_io](https://twitter.com/futurestud_io)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuturestudio%2Fhapi-dev-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuturestudio%2Fhapi-dev-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuturestudio%2Fhapi-dev-errors/lists"}