From 3d9f68da98a7237d0d5bf7ae7a0bd8ee91484bf6 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Fri, 11 Apr 2014 19:01:29 +0700 Subject: [PATCH] catch uncaught exceptions in `production` env --- lib/AppSpine.coffee | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/AppSpine.coffee b/lib/AppSpine.coffee index 5b7a024..a533d67 100644 --- a/lib/AppSpine.coffee +++ b/lib/AppSpine.coffee @@ -15,8 +15,10 @@ module.exports = class AppSpine extends EventEmitter2 @init() if @config.initializers? process.title = @config.appName if @config.appName? - process.on 'uncaughtException', (err) => - @logger.error 'uncaughtException', err + + if @isProduction() + process.on 'uncaughtException', (err) => + @logger.error 'uncaughtException', err getEnvironment: -> @config.env or process.env.NODE_ENV or 'development' diff --git a/package.json b/package.json index 389921d..e9e56d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appspine", - "version": "0.0.7", + "version": "0.0.8", "description": "node.js application namespace base class", "keywords": [ "application",