Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set a global uncaught exception handler in Meteor?

Tags:

meteor

I'd like to catch uncaught exceptions in Meteor and handle them in a graceful fashion. Is there an analogue to Node's process.on('uncaughtException', function(err) {})?

I'm interested in solutions both in the client and in the server.

like image 360
jagill Avatar asked Apr 28 '13 21:04

jagill


1 Answers

I am testing this idea for server side uncaught exception handling.

Fiber = Npm.require('fibers');
process.on('uncaughtException', function(err){
    console.log(err.message);
    console.log(err.stack);
    Fiber( function(){
        Logs.insert({ ... }) // Logs is a collection
    }).run();
    process.exit(1)
};
like image 180
DerMambo Avatar answered Jan 14 '23 13:01

DerMambo