-
-
Save arunoda/9fca292380dd576ee6f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/hijack/error.js b/lib/hijack/error.js | |
index 6b7b285..785d42e 100644 | |
--- a/lib/hijack/error.js | |
+++ b/lib/hijack/error.js | |
@@ -7,13 +7,13 @@ TrackUncaughtExceptions = function () { | |
// let the server crash normally if error tracking is disabled | |
if(!Kadira.options.enableErrorTracking) { | |
- throw err; | |
+ printErrorAndKill(err); | |
} | |
// looking for already tracked errors and throw them immediately | |
// throw error immediately if kadira is not ready | |
if(err._tracked || !Kadira.connected) { | |
- throw err; | |
+ printErrorAndKill(err); | |
} | |
var trace = getTrace(err, 'server-crash', 'uncaughtException'); | |
@@ -34,10 +34,18 @@ TrackUncaughtExceptions = function () { | |
process.nextTick(function() { | |
// we need to mark this error where we really need to throw | |
err._tracked = true; | |
- throw err; | |
+ printErrorAndKill(err); | |
}); | |
} | |
}); | |
+ | |
+ function printErrorAndKill(err) { | |
+ // since we are capturing error, we are also on the error message. | |
+ // so developers think we are also reponsible for the error. | |
+ // But we are not. This will fix that. | |
+ console.error(err.stack); | |
+ process.exit(7); | |
+ } | |
} | |
TrackMeteorDebug = function () { | |
diff --git a/lib/hijack/wrap_server.js b/lib/hijack/wrap_server.js | |
index 87dfff5..8a1951a 100644 | |
--- a/lib/hijack/wrap_server.js | |
+++ b/lib/hijack/wrap_server.js | |
@@ -4,7 +4,11 @@ wrapServer = function(serverProto) { | |
var originalHandleConnect = serverProto._handleConnect | |
serverProto._handleConnect = function(socket, msg) { | |
originalHandleConnect.call(this, socket, msg); | |
- if(Kadira.connected) { | |
+ var session = socket._meteorSession; | |
+ // sometimes it is possible for _meteorSession to be undefined | |
+ // one such reason would be if DDP versions are not matching | |
+ // if then, we should not process it | |
+ if(Kadira.connected && session) { | |
Kadira.models.system.handleSessionActivity(msg, socket._meteorSession); | |
} | |
}; | |
diff --git a/lib/hijack/wrap_session.js b/lib/hijack/wrap_session.js | |
index d7ff1c6..e04deb9 100644 | |
--- a/lib/hijack/wrap_session.js | |
+++ b/lib/hijack/wrap_session.js | |
@@ -194,7 +194,7 @@ function wrapMethodHanderForErrors(name, originalHandler, methodMap) { | |
function cloneError(err) { | |
if(err instanceof Meteor.Error) { | |
- var newError = new Meteor.Error(err.error, err.reason); | |
+ var newError = err.clone(); | |
} else { | |
var newError = new Error(err.message); | |
} | |
diff --git a/package.js b/package.js | |
index 45409ea..e585bac 100644 | |
--- a/package.js | |
+++ b/package.js | |
@@ -1,6 +1,6 @@ | |
Package.describe({ | |
"summary": "Performance Monitoring for Meteor", | |
- "version": "2.17.0", | |
+ "version": "2.17.5", | |
"git": "https://github.com/meteorhacks/kadira.git", | |
"name": "meteorhacks:kadira" | |
}); | |
diff --git a/smart.json b/smart.json | |
index 53f9084..68051a9 100644 | |
--- a/smart.json | |
+++ b/smart.json | |
@@ -3,7 +3,7 @@ | |
"description": "Performance Monitoring for Meteor", | |
"homepage": "https://kadira.io", | |
"author": "MeteorHacks <hello@meteorhacks.com>", | |
- "version": "2.17.0", | |
+ "version": "2.17.5", | |
"git": "https://github.com/meteorhacks/kadira.git", | |
"packages": { | |
"meteorx": "1.2.0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment