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