Book Image

Deploying Node.js

By : Sandro Pasquali
Book Image

Deploying Node.js

By: Sandro Pasquali

Overview of this book

Table of Contents (14 chapters)
Deploying Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Dealing with failure


As we outlined in Chapter 4, Managing Memory and Space, isolating operations and intelligently monitoring an applications help to minimize the chances of one failed subsystem taking down the larger system. In this section, we'll look at how to catch errors and exceptions within a Node program and how to gracefully shut down and/or restart a process that has become unstable individually and within clusters.

Note

The following comprehensive article on handling errors with Node.js is recommended:

http://www.joyent.com/developers/node/design/errors

Peppering a codebase with try/catch blocks and trying to anticipate all errors can become unmanageable and unwieldy. Additionally, what if an exception you didn't anticipate occurs? How do you pick up where you left off?

Node does not yet have a good built-in way to handle uncaught critical exceptions. This is a weakness of the platform. An exception that is uncaught will continue to bubble up through the execution stack until it...