From fa517976025a35c79e4fe6053f3f403bec1721c3 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Sat, 19 Oct 2013 01:35:41 +0400 Subject: [PATCH] return 500 instead of 404 if local storage is corrupted --- lib/storage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/storage.js b/lib/storage.js index 6a032482a..94df5b3f2 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -331,7 +331,14 @@ Storage.prototype.get_package = function(name, callback) { async.map(uplinks, function(up, cb) { up.get_package(name, function(err, up_res) { - if (err) return cb(); + if (err) { + if (up === self.local && (!err.status || err.status >= 500)) { + // report internal errors right away + return cb(err) + } else { + return cb() + } + } if (up === self.local) { // file exists in local repo