diff --git a/packages/livedata/livedata_server.js b/packages/livedata/livedata_server.js index 0ff5dd81f3..11d1114bba 100644 --- a/packages/livedata/livedata_server.js +++ b/packages/livedata/livedata_server.js @@ -1456,6 +1456,11 @@ var wrapInternalException = function (exception, context) { if (!exception || exception instanceof Meteor.Error) return exception; + // tests can set the 'expected' flag on an exception so it won't go to the + // server log + if (!exception.expected) + Meteor._debug("Exception " + context, exception.stack); + // Did the error contain more details that could have been useful if caught in // server code (or if thrown from non-client-originated code), but also // provided a "sanitized" version with more context than 500 Internal server @@ -1467,11 +1472,6 @@ var wrapInternalException = function (exception, context) { "is not a Meteor.Error; ignoring"); } - // tests can set the 'expected' flag on an exception so it won't go to the - // server log - if (!exception.expected) - Meteor._debug("Exception " + context, exception.stack); - return new Meteor.Error(500, "Internal server error"); };