Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only install the uncaught exception handler when not under test.

This keeps the locker from shooting the test framework in the head
whenever an assertion fails. Now to do something about the logging.
  • Loading branch information...
commit 67f748aba94cb49afe80dee806e131fe3400a8bd 1 parent dc6fc11
@othiym23 othiym23 authored
Showing with 24 additions and 21 deletions.
  1. +23 −21 lockerd.js
  2. +1 −0  test/lib/locker-helper.js
View
44 lockerd.js
@@ -289,30 +289,32 @@ process.on("SIGTERM", function() {
shutdown(0);
});
-process.on('uncaughtException', function(err) {
+if (!process.env.LOCKER_TEST) {
+ process.on('uncaughtException', function(err) {
try {
- logger.error('Uncaught exception:');
- logger.error(util.inspect(err));
- if(err && err.stack) logger.error(util.inspect(err.stack));
- if (lconfig.airbrakeKey) {
- var airbrake = require('airbrake').createClient(lconfig.airbrakeKey);
- airbrake.notify(err, function(err, url) {
- if(url) logger.error(url);
- shutdown(1);
- });
- }else{
- shutdown(1);
- }
+ logger.error('Uncaught exception:');
+ logger.error(util.inspect(err));
+ if (err && err.stack) logger.error(util.inspect(err.stack));
+ if (lconfig.airbrakeKey) {
+ var airbrake = require('airbrake').createClient(lconfig.airbrakeKey);
+ airbrake.notify(err, function(err, url) {
+ if (url) logger.error(url);
+ shutdown(1);
+ });
+ } else {
+ shutdown(1);
+ }
} catch (e) {
- try {
- console.error("Caught an exception while handling an uncaught exception!");
- console.error(e);
- } catch (e) {
- // we tried...
- }
- process.exit(1);
+ try {
+ console.error("Caught an exception while handling an uncaught exception!");
+ console.error(e);
+ } catch (e) {
+ // we tried...
+ }
+ process.exit(1);
}
-});
+ });
+}
// Export some things so this can be used by other processes, mainly for the test runner
exports.shutdown = shutdown;
View
1  test/lib/locker-helper.js
@@ -16,6 +16,7 @@ exports.configurate = function () {
process.env.NODE_PATH = path.join(__dirname, '..', '..', 'Common', 'node');
+ process.env.LOCKER_TEST = "oh yeah";
process.env.LOCKER_ROOT = path.join(__dirname, '..', '..');
process.env.LOCKER_CONFIG = path.join(__dirname, '..', 'resources');
process.env.LOCKER_ME = temp.path({prefix : 'Me.',
Please sign in to comment.
Something went wrong with that request. Please try again.