From 3f746eb7c8d8a32b0c4df138aa5eeef668ed9d45 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Sun, 22 Jun 2014 18:06:16 +0400 Subject: [PATCH] fix logging: in search "error" can be legitimate output (package named "error"), not an actual error ref #65 --- lib/middleware.js | 2 +- lib/up-storage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/middleware.js b/lib/middleware.js index 872680382..629da8c8a 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -134,7 +134,7 @@ module.exports.log_and_etagify = function(req, res, next) { res.header('Content-type', 'application/json') if (typeof(body) === 'object' && body != null) { - if (body.error) { + if (typeof(body.error) === 'string') { res._sinopia_error = body.error } body = JSON.stringify(body, undefined, '\t') + '\n' diff --git a/lib/up-storage.js b/lib/up-storage.js index 7ff19bd4c..1a8a9c5fd 100644 --- a/lib/up-storage.js +++ b/lib/up-storage.js @@ -174,7 +174,7 @@ Storage.prototype.request = function(options, cb) { } if (!err && utils.is_object(body)) { - if (body.error) { + if (typeof(body.error) === 'string') { error = body.error } }