From cb2a11cfc5e3b17f793b0487ef811604d37020a2 Mon Sep 17 00:00:00 2001 From: ben hockey Date: Mon, 29 Dec 2014 16:15:35 -0600 Subject: [PATCH] prevent unhandled rejections being thrown --- jsgi/rest-store.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jsgi/rest-store.js b/jsgi/rest-store.js index 44db76f..8c7fb16 100644 --- a/jsgi/rest-store.js +++ b/jsgi/rest-store.js @@ -21,7 +21,7 @@ module.exports = function(options){ metadata[i] = headers[i]; } metadata.request = request; - + var responseValue; var status = 200; var headers = { @@ -74,7 +74,7 @@ module.exports = function(options){ if(path){ metadata.id = decodeURIComponent(path); } - + if(!METHOD_HAS_BODY[method]){ if(method === "get" && (!path || path.charAt(path.length-1) == '/')){ var queryString = request.queryString.replace(/\?.*/,''); @@ -141,7 +141,7 @@ module.exports = function(options){ status = 201; headers.location = headers["content-location"]; // maybe it should come from transaction.generatedId? } - }); + }, ignore); // prevent an unhandled rejection being thrown. the return value below will propagate errors } } else{ @@ -161,5 +161,8 @@ module.exports = function(options){ }); }; }; + +function ignore() {} + // back-compat property access -module.exports.RestStore = module.exports; \ No newline at end of file +module.exports.RestStore = module.exports;