Home Forums Chapter 8: Express in Production Domain handler on error handler

This topic contains 1 reply, has 2 voices, and was last updated by  Yaapa 1 year, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #81

    gdbtek
    Participant

    On page 202, here is the sample code to handle error on domain. However, I don’t quite understand the whole example. I looked at sample at http://nodejs.org/api/domain.html but this do not use express. Can you provide full sample for following sample?

    // Domain error handler
    d.on('error', function(err) {
    // Stop accepting new connections
    server.close();
    // Perform last-minute cleanup
    res.send(500);
    // Let the master know the worker has disconnected
    cluster.worker.disconnect();
    // Terminate the process in 5 seconds
    setTimeout(function() {
    // Exit with a failure code
    process.process.exit(1);
    }, 5000);
    });
    #87

    Yaapa
    Keymaster

    The example on Page no. 201 is a complete example using an Express app.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.