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:
parent
3db5f928ee
commit
7d32636133
@ -245,7 +245,7 @@ LocalFileSystem.prototype.get = function(scope, key, callback) {
|
|||||||
return this.cache.get(scope,key,callback);
|
return this.cache.get(scope,key,callback);
|
||||||
}
|
}
|
||||||
if(typeof callback !== "function"){
|
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);
|
var storagePath = getStoragePath(this.storageBaseDir ,scope);
|
||||||
loadFile(storagePath + ".json").then(function(data){
|
loadFile(storagePath + ".json").then(function(data){
|
||||||
@ -304,7 +304,7 @@ LocalFileSystem.prototype.set = function(scope, key, value, callback) {
|
|||||||
}, this.flushInterval);
|
}, this.flushInterval);
|
||||||
}
|
}
|
||||||
} else if (callback && typeof callback !== 'function') {
|
} 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 {
|
} else {
|
||||||
self.writePromise = self.writePromise.then(function() { return loadFile(storagePath + ".json") }).then(function(data){
|
self.writePromise = self.writePromise.then(function() { return loadFile(storagePath + ".json") }).then(function(data){
|
||||||
var obj = data ? JSON.parse(data) : {}
|
var obj = data ? JSON.parse(data) : {}
|
||||||
|
Loading…
Reference in New Issue
Block a user