From ce15e660cb82c4678f40332083e9b4345106c1f0 Mon Sep 17 00:00:00 2001 From: Eric Durocher Date: Mon, 18 Aug 2014 10:54:49 -0500 Subject: [PATCH 1/2] Add URL to uncaught exception logging for troubleshooting --- lib/middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/middleware.js b/lib/middleware.js index a7450a4..7b95a18 100755 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -262,7 +262,7 @@ exports.getMiddleware = function(options, cb) { if (err.message == _404error) { logger.error({category: '404', message: 'Request for non-existent resource: ' + req.originalUrl}); } else { - logger.error({category: 'uncaught', message: 'Uncaught Exception in request middleware stack --- Stacktrace:', exception: err}); + logger.error({category: 'uncaught', message: 'Uncaught Exception in request middleware stack --- URL: ' + (req ? req.originalUrl : '') + ', Stacktrace:', exception: err}); } next(err); } From 6a9909db22fd69e55687e4fe7d5c7523cfdcdfb1 Mon Sep 17 00:00:00 2001 From: Eric Durocher Date: Mon, 18 Aug 2014 10:56:01 -0500 Subject: [PATCH 2/2] Fogbugz 18206: Avoid sending contentType when no data --- lib/feather-client/restProxy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/feather-client/restProxy.js b/lib/feather-client/restProxy.js index f248803..bc1c0ce 100644 --- a/lib/feather-client/restProxy.js +++ b/lib/feather-client/restProxy.js @@ -40,13 +40,14 @@ } } + var requestData = (typeof options.data === "undefined" || options.data === null) ? null : JSON.stringify(options.data); $.ajax({ url: encodeURI("/_rest/" + api.name + decodeURI(options.path)), - data: (typeof options.data === "undefined" || options.data === null) ? null : JSON.stringify(options.data), + data: requestData, type: method.verb, dataType: "json", headers: options.headers || null, - contentType: contentType, + contentType: requestData ? contentType : null, // don't set contentType if no data, bodyParser will throw exception. success: function(result) { cb && cb({ success: true,