mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
⚡ Display helpful error message if n8n-config file is not valid JSON
This commit is contained in:
parent
8ffa7a2265
commit
3623828283
|
@ -159,9 +159,14 @@ export async function getUserSettings(settingsPath?: string, ignoreCache?: boole
|
|||
}
|
||||
|
||||
const settingsFile = await fsReadFile(settingsPath, 'utf8');
|
||||
settingsCache = JSON.parse(settingsFile);
|
||||
|
||||
return JSON.parse(settingsFile) as IUserSettings;
|
||||
try {
|
||||
settingsCache = JSON.parse(settingsFile);
|
||||
} catch (error) {
|
||||
throw new Error(`Error parsing n8n-config file "${settingsPath}". It does not seem to be valid JSON.`);
|
||||
}
|
||||
|
||||
return settingsCache as IUserSettings;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue