{"id":13432633,"url":"https://github.com/quorrajs/Ouch","last_synced_at":"2025-03-17T10:32:20.088Z","repository":{"id":28452323,"uuid":"31967862","full_name":"quorrajs/Ouch","owner":"quorrajs","description":"NodeJS errors for cool kids","archived":false,"fork":false,"pushed_at":"2022-09-22T15:27:12.000Z","size":721,"stargazers_count":199,"open_issues_count":3,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-12T09:10:05.860Z","etag":null,"topics":["beautify","errorhandling","nodejs"],"latest_commit_sha":null,"homepage":"https://quorrajs.github.io/Ouch","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/quorrajs.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}},"created_at":"2015-03-10T16:18:03.000Z","updated_at":"2024-08-26T13:32:48.000Z","dependencies_parsed_at":"2022-08-03T00:15:52.936Z","dependency_job_id":null,"html_url":"https://github.com/quorrajs/Ouch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quorrajs%2FOuch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quorrajs%2FOuch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quorrajs%2FOuch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quorrajs%2FOuch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quorrajs","download_url":"https://codeload.github.com/quorrajs/Ouch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244016781,"owners_count":20384203,"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":["beautify","errorhandling","nodejs"],"created_at":"2024-07-31T02:01:14.476Z","updated_at":"2025-03-17T10:32:19.339Z","avatar_url":"https://github.com/quorrajs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Ouch\n====\n\nNodeJS errors for cool kids\n\n[![npm version](https://badge.fury.io/js/ouch.svg)](http://badge.fury.io/js/ouch)\n[![Build Status](https://travis-ci.org/quorrajs/Ouch.svg?branch=master)](https://travis-ci.org/quorrajs/Ouch)\n[![Quality](https://codeclimate.com/github/quorrajs/Ouch/badges/gpa.svg)](https://codeclimate.com/github/quorrajs/Ouch)\n[![Documentation Status](https://readthedocs.org/projects/ouch/badge/?version=latest)](https://readthedocs.org/projects/ouch/?badge=latest)\n\n-----\n\n![Ouch!](http://i.imgur.com/EPXL1Zq.png)\n\n**Ouch** is a NodeJS implementation of PHP's [Whoops](https://github.com/filp/whoops) library. It's not an exact port of\nWhoops, but implements similar functionality and uses same front end resources in some of its error handlers. It is an\nerror handler base/framework for NodeJs. Out-of-the-box, it provides a pretty error interface that helps you debug your\nweb projects, but at heart it's a simple yet powerful stacked error handling system.\n\n### Pretty page handler demo\n\n[Blue theme](https://quorrajs.github.io/Ouch/demo/)\n\n[Orange theme](https://quorrajs.github.io/Ouch/demo/orange.html)\n\n## Installation\n\nThe source is available for download from [GitHub](https://github.com/quorrajs/Ouch). Alternatively, you\ncan install using Node Package Manager (npm):\n\n```javascript\nnpm install ouch\n```\n\n## Usage examples\n\n``` javascript\n    // With PrettyPageHandler\n    http.createServer(function nsjfkj(req, res){\n\n        if (req.url === '/favicon.ico') {\n            res.writeHead(200, {'Content-Type': 'image/x-icon'} );\n            res.end();\n            return;\n        }\n\n        var d = domain.create();\n\n        d.on('error', function(e){\n            var ouchInstance = (new Ouch).pushHandler(\n                    new Ouch.handlers.PrettyPageHandler('orange', null, 'sublime')\n                );\n            ouchInstance.handleException(e, req, res, function (output) {\n                console.log('Error handled properly')\n            });\n        });\n        d.run(function(){\n\n            // your application code goes here\n\n        });\n\n    }).listen('1338', 'localhost');\n\n\n    // With custom callback\n    var ouchInstance = (new Ouch).pushHandler(\n        function(next, exception, inspector, run, request, response){\n\n            // custom handler logic\n\n            next();\n        });\n\n    ouchInstance.handleException(e, req, res, function (output) {\n        console.log('Error handled properly')\n    });\n```\n\nFor more options, have a look at the example files in examples to get a feel for how things work. Also take a look at the [API Documentation](http://ouch.readthedocs.org/en/latest/api-docs/) and the list of available handlers below.\n\n### Available Handlers\n\n**Ouch** currently ships with the following built-in handlers, available in the `require(\"ouch\").handlers` namespace:\n\n- [`PrettyPageHandler`](https://github.com/quorrajs/Ouch/blob/master/handler/PrettyPageHandler.js) - Shows a pretty error page when something goes pants-up\n- [`JsonResponseHandler`](https://github.com/quorrajs/Ouch/blob/master/handler/JsonResponseHandler.js) - Process errors and returns information on them as a JSON string.\n- [`CallbackHandler`](https://github.com/quorrajs/Ouch/blob/master/handler/CallbackHandler.js) - Wraps a callable as a handler. You do not need to use this handler explicitly, Ouch will automatically wrap any callable you pass to `ouchInstance.pushHandler`.\n\n## Todo\n\n    - Add more handlers.\n\n## License\n\nOuch is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquorrajs%2FOuch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquorrajs%2FOuch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquorrajs%2FOuch/lists"}