From 2b70d5cf8f525fba8d9286bd94451b2c4f18f0ae Mon Sep 17 00:00:00 2001 From: Joannic Laborde Date: Mon, 8 Feb 2016 11:53:37 -0500 Subject: [PATCH] Do not report optional resource errors to Sentry --- lib/page.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/page.js b/lib/page.js index 22e218e..7f2a51b 100644 --- a/lib/page.js +++ b/lib/page.js @@ -189,13 +189,15 @@ var Page = function( page_path, options ){ if (status == 404) { server.logger.log(page.route + ' [' + resource.name + '] ' + error, 3); } else { - server.logger.log(page.route + ' [' + resource.name + '] ' + error, resource.options.optional ? 1 : 0); - page.logToSentry(error, { - error: err, - resource: {name: resource.name, url: resource.resource.url}, - response: resource_response ? {status: resource_response.status, body: resource_response.data} : null, - context: _.omit(context, 'resources') - }); + server.logger.log(page.route + ' [' + resource.name + '] ' + error, is_optional ? 1 : 0); + if (!is_optional) { + page.logToSentry(error, { + error: err, + resource: {name: resource.name, url: resource.resource.url}, + response: resource_response ? {status: resource_response.status, body: resource_response.data} : null, + context: _.omit(context, 'resources') + }); + } } err = {status: status, error: error, message: err, resource: resource.name};