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};