Need help with Ouch?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

197 Stars 10 Forks MIT License 88 Commits 2 Opened issues


NodeJS errors for cool kids

Services available


Need anything else?

Contributors list


NodeJS errors for cool kids

npm version Build Status Quality Documentation Status


Ouch is a NodeJS implementation of PHP's Whoops library. It's not an exact port of Whoops, but implements similar functionality and uses same front end resources in some of its error handlers. It is an error handler base/framework for NodeJs. Out-of-the-box, it provides a pretty error interface that helps you debug your web projects, but at heart it's a simple yet powerful stacked error handling system.

Pretty page handler demo

Blue theme

Orange theme


The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

npm install ouch

Usage examples

    // With PrettyPageHandler
    http.createServer(function nsjfkj(req, res){

    if (req.url === '/favicon.ico') {
        res.writeHead(200, {'Content-Type': 'image/x-icon'} );

    var d = domain.create();

    d.on('error', function(e){
        var ouchInstance = (new Ouch).pushHandler(
                new Ouch.handlers.PrettyPageHandler('orange', null, 'sublime')
        ouchInstance.handleException(e, req, res, function (output) {
            console.log('Error handled properly')

        // your application code goes here


}).listen('1338', 'localhost');

// With custom callback
var ouchInstance = (new Ouch).pushHandler(
    function(next, exception, inspector, run, request, response){

        // custom handler logic


ouchInstance.handleException(e, req, res, function (output) {
    console.log('Error handled properly')

For 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 and the list of available handlers below.

Available Handlers

Ouch currently ships with the following built-in handlers, available in the

  • PrettyPageHandler
    - Shows a pretty error page when something goes pants-up
  • JsonResponseHandler
    - Process errors and returns information on them as a JSON string.
  • CallbackHandler
    - Wraps a callable as a handler. You do not need to use this handler explicitly, Ouch will automatically wrap any callable you pass to


- Add more handlers.


Ouch is open-sourced software licensed under the MIT license.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.