1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Improve file store error when cache disabled and sync api used

Closes #2406
This commit is contained in:
Nick O'Leary 2020-02-07 14:26:30 +00:00
parent 3db5f928ee
commit 7d32636133
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -245,7 +245,7 @@ LocalFileSystem.prototype.get = function(scope, key, callback) {
return this.cache.get(scope,key,callback);
}
if(typeof callback !== "function"){
throw new Error("Callback must be a function");
throw new Error("File Store cache disabled - only asynchronous access supported");
}
var storagePath = getStoragePath(this.storageBaseDir ,scope);
loadFile(storagePath + ".json").then(function(data){
@ -304,7 +304,7 @@ LocalFileSystem.prototype.set = function(scope, key, value, callback) {
}, this.flushInterval);
}
} else if (callback && typeof callback !== 'function') {
throw new Error("Callback must be a function");
throw new Error("File Store cache disabled - only asynchronous access supported");
} else {
self.writePromise = self.writePromise.then(function() { return loadFile(storagePath + ".json") }).then(function(data){
var obj = data ? JSON.parse(data) : {}