mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 07:24:53 +09:00
Annotate error when loading module.json fails
If a plugin has an invalid module/module.json file this should also give a readable error.
This commit is contained in:
1 parent
033de0e20a
commit
58e5d96e1d
1 file changed
+6
-1
@@ -757,7 +757,12 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
throw new Error(`Module for plugin ${pluginName} is missing module.json`);
|
||||
}
|
||||
|
||||
let module = JSON.parse(await fs.readFile(moduleJsonPath));
|
||||
let module;
|
||||
try {
|
||||
module = JSON.parse(await fs.readFile(moduleJsonPath));
|
||||
} catch (err) {
|
||||
throw new Error(`Loading module/module.json in plugin ${pluginName} failed: ${err.message}`);
|
||||
}
|
||||
if (module.name !== pluginName) {
|
||||
throw new Error(`Expected name of module for plugin ${pluginName} to match the plugin name`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user