From 91324b2531f95f5dd1c147b2003c0a7bc85884bc Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 10 Sep 2016 23:56:18 -0700 Subject: [PATCH] ldb: error on missing features. --- lib/db/lowlevelup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/db/lowlevelup.js b/lib/db/lowlevelup.js index 63ee4373..5e94fc9c 100644 --- a/lib/db/lowlevelup.js +++ b/lib/db/lowlevelup.js @@ -85,7 +85,7 @@ LowlevelUp.prototype.destroy = function destroy(callback) { assert(!this.loaded); if (!this.backend.destroy) - return utils.nextTick(callback); + return utils.asyncify(callback)(new Error('Cannot destroy.')); this.backend.destroy(this.location, callback); }; @@ -225,6 +225,10 @@ LowlevelUp.prototype.getProperty = function getProperty(name) { LowlevelUp.prototype.approximateSize = function approximateSize(start, end, callback) { assert(this.loaded, 'Cannot use database before it is loaded.'); + + if (!this.binding.approximateSize) + return utils.asyncify(callback)(new Error('Cannot get size.')); + this.binding.approximateSize(start, end, callback); };