mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
⚡ Display helpful error message if n8n-config file is not valid JSON
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user