debug.me

0.3.2 • Public • Published

Installation

  1. install via npm:

    npm install debug.me --save

  2. put to config/autoload.js (compoundjs only);

    require('debug.me');

Usage

var debugme = require('debug.me');

// global error hanler
debugme.registerGlobalHandler([customHandler]);
// customHandler - optional function param which called with error,
// if customHandler is not specified process will exist,
// when customHandler is specified, then it is a responsibility of
// customHandler to exit process (see example)
// customHandler called after reporting about error

// custom error reporter
var reportError = debugme.errorReporter();
reportError(new Error('Message'), function() {
    console.log('error reported');
});

// error reporter middleware for express/compound
app.use(debugme.middleware([customHandler]));
// customHandler - optional function param which called with `error` and `next`
// if customHandler is not specified next will be called inside handler
// when customHandler is specified, then it is a responsibility of
// customHandler to call `next` with error passed to it as first arguments (see example)
// customHandler called after reporting about error

Config (compound apps)

app.enable('send-errors');
app.enable('skip-global-errors');

// optionally customHandler can be specified for uncaught errors
compound.onUncaughtError = function(err) {
    compound.log(err);
    process.exit(1);
};
// and for uncaught error
compound.onCaughtError = function(err, next) {
    compound.log(err);
    next(err);
};

Readme

Keywords

none

Package Sidebar

Install

npm i debug.me

Weekly Downloads

1

Version

0.3.2

License

MIT

Last publish

Collaborators

  • anatoliy