Skip to content

Commit

Permalink
Uncaught errors will no longer crash the server
Browse files Browse the repository at this point in the history
  • Loading branch information
vram4 committed Jul 2, 2015
1 parent 7970f7b commit 08820d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ Log.prototype.setup = function(gameServer) {
case 1:
console_log = fs.createWriteStream('./logs/console.log', {flags : 'w'});

process.on('uncaughtException', function(err) {
console.log(err.stack);
});

console.log = function(d) { //
console_log.write(util.format(d) + EOL);
process.stdout.write(util.format(d) + EOL);
Expand All @@ -42,7 +38,11 @@ Log.prototype.setup = function(gameServer) {
this.onCommand = function(command) {
console_log.write(">" + command + EOL);
};
break;
case 0:
// Prevent crashes
process.on('uncaughtException', function(err) {
console.log(err.stack);
});
default:
break;
}
Expand Down

0 comments on commit 08820d6

Please sign in to comment.