node-exception-notifier

0.0.1 • Public • Published

node-exception-notifier

Sends out an email to the given recipient with information about an uncaught exception.

Screenshots

Screenshot 1

Installation

The following versions are required for Hotload:

  • Node.js >= 0.2.2
  • npm >= 0.1.25

Install it simply via npm:

npm install node-exception-notifier

API

new ExceptionNotifier( options )

Creates a new instance of ExceptionNotifier. options is an object with the following possible properties:

  • to: Defines where the exception notifications should be sent
  • from: Defines the "From" header for the notification mails. Defaults to Node.js Exception Notifer <noreply@yourdomain.com>
  • host, port: SMTP mail host and port
  • domain: SMTP host, usually the same as host
  • auth_user, auth_password: Options for SMTP authentification
  • exit: Defines whether the process should exit after an uncaught exception has been notified

Example

var ExceptionNotifier, notifier;
ExceptionNotifier = require("./index").ExceptionNotifier;
notifier = new ExceptionNotifier({
  to: "Recipient <you@domain.com>",
  from: "Node.js Exception Notifier <noreply@domain.com>",
  host: "mail.domain.com",
  port: 25,
  domain: "mail.domain.com",
  auth_user: "user",
  auth_password: "password",
  exit: true
});
throw new Error("Urgh I'm a dirty error.");
/*
This would send a mail to you@domain.com which looks like this:

To: Recipient (you@domain.com)
From: Node.js Exception Notifier (noreply@domain.com)
Subject: Uncaught Exception: Urgh I'm a dirty error.

Error: Urgh I'm a dirty error.
   at Object.<anonymous> (/Users/sascha/development/node/node-exception-notifier/example.js:13:7)
   at Module._compile (node.js:423:30)
   at Object..js (node.js:429:14)
   at Module.load (node.js:355:35)
   at Array.<anonymous> (node.js:443:26)
   at EventEmitter._tickCallback (node.js:60:24)
*/

License

Copyright (c) 2011 FILSH Media GmbH, released under the MIT license

Readme

Keywords

none

Package Sidebar

Install

npm i node-exception-notifier

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • saschagehlich