From be92bc5e4f57b1e69beb707e6992844b8d25b4c6 Mon Sep 17 00:00:00 2001 From: littleskunk Date: Thu, 20 Jul 2017 00:22:30 +0200 Subject: [PATCH] Invalid storage size print out missing bytes --- lib/utils.js | 3 ++- test/utils.unit.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 2c9cce2..522ea99 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -98,7 +98,8 @@ exports.validateAllocation = function(conf, callback) { } if (allocatedSpace > free + usedSpaceBytes) { - return callback(new Error('Invalid storage size')); + return callback(new Error('Invalid storage size: '+ + -(free + usedSpaceBytes - allocatedSpace) +' bytes missing')); } return callback(null); diff --git a/test/utils.unit.js b/test/utils.unit.js index fc7dd82..d08710c 100644 --- a/test/utils.unit.js +++ b/test/utils.unit.js @@ -183,7 +183,8 @@ describe('module:utils', function() { }, function(err) { getFreeSpace.restore(); getDirectorySize.restore(); - expect(err.message).to.equal('Invalid storage size'); + expect(err.message).to.equal( + 'Invalid storage size: 1024 bytes missing'); done(); }); });