mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Log error if settings unavailable when saving user settings
Fixes #1645
This commit is contained in:
parent
f4c2938b41
commit
52d9578a19
@ -88,6 +88,7 @@ module.exports = {
|
||||
}
|
||||
var currentSettings = settings.getUserSettings(username)||{};
|
||||
currentSettings = extend(currentSettings, req.body);
|
||||
try {
|
||||
settings.setUserSettings(username, currentSettings).then(function() {
|
||||
log.audit({event: "settings.update",username:username},req);
|
||||
res.status(204).end();
|
||||
@ -95,6 +96,11 @@ module.exports = {
|
||||
log.audit({event: "settings.update",username:username,error:err.code||"unexpected_error",message:err.toString()},req);
|
||||
res.status(400).json({error:err.code||"unexpected_error", message:err.toString()});
|
||||
});
|
||||
} catch(err) {
|
||||
log.warn(log._("settings.user-not-available",{message:log._("settings.not-available")}));
|
||||
log.audit({event: "settings.update",username:username,error:err.code||"unexpected_error",message:err.toString()},req);
|
||||
res.status(400).json({error:err.code||"unexpected_error", message:err.toString()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@
|
||||
},
|
||||
|
||||
"settings": {
|
||||
"user-not-available": "Cannot save user settings: __message__",
|
||||
"not-available": "Settings not available",
|
||||
"property-read-only": "Property '__prop__' is read-only"
|
||||
},
|
||||
|
@ -173,6 +173,9 @@ var persistentSettings = {
|
||||
return clone(userSettings[username]);
|
||||
},
|
||||
setUserSettings: function(username,settings) {
|
||||
if (globalSettings === null) {
|
||||
throw new Error(log._("settings.not-available"));
|
||||
}
|
||||
var current = userSettings[username];
|
||||
userSettings[username] = settings;
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user