Skip to content

Commit

Permalink
Added default error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-l committed Jul 1, 2016
1 parent e17a57f commit bfdc9b6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ function MockCouch(server, options) {
this.changes = {};
this.sequence = {};

// Default error handler. Personalize according to your needs.
/*jslint unparam:true*/
server.on('uncaughtException', function (req, res, route, err) {
console.log('******* Begin Error *******');
console.log(route);
console.log('*******');
console.log(err.stack);
console.log('******* End Error *******');
if (!res.headersSent) {
return res.send(500, { ok : false });
}
res.write("\n");
res.end();
});
/*jslint unparam:false*/

(function (server, self) {
var all_dbs, all_docs, get_db, get_changes, get_view, get_doc, put_doc, get_uuids, get_show;
/**
Expand Down

0 comments on commit bfdc9b6

Please sign in to comment.