Browse files


  • Loading branch information...
tj committed Apr 20, 2011
1 parent 60cdd18 commit 1e4f07646de5d032c303ed7d470f01660378550e
Showing with 11 additions and 1 deletion.
  1. +11 −1
@@ -29,11 +29,21 @@
res.end('Hello World');
- cluster(server)
+ cluster = cluster(server)
.use(mail('', { from: '' }))
.use(mail(['', '']))
+ By default cluster-mail can only notify uncaughtExceptions, however it is typically a good idea to do so from within your application's error handler as well. Below we invoke `cluster.mailException()`, where `cluster` is the return value of `cluster(server)`. We can pass an object containing data to add to the report, such as the authenticated user's id, email, request data, etc.
+ app.error(function(err, req, res, next){
+ cluster.mailException(err, {
+ method: req.method
+ , url: req.url
+ , headers: req.headers
+ });
+ });
## Manual Reporting Example
Often it is useful to report an exception within a worker that was caught, thus never terminating the process, in turn never notifying cluster's master process. An example of this would be within a connect or express error handler, where you simply responded with an error page, however you still want to be notified via mail.

0 comments on commit 1e4f076

Please sign in to comment.