Merge branch 'develop' into config_logger

This commit is contained in:
Michael Teeuw 2020-06-14 14:02:48 +02:00 committed by GitHub
commit c40a5648dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,6 @@ _This release is scheduled to be released on 2020-07-01._
- Compliments Module - Add Advice API (https://api.adviceslip.com/) Option - Compliments Module - Add Advice API (https://api.adviceslip.com/) Option
- Added option to config the level of logging - Added option to config the level of logging
- Added prettier for an even cleaner codebase - Added prettier for an even cleaner codebase
- Hide Sunrise/Sunset in Weather module - Hide Sunrise/Sunset in Weather module
### Updated ### Updated
@ -37,6 +36,7 @@ _This release is scheduled to be released on 2020-07-01._
- Add backward compatibility for old module code in socketclient.js [#1973](https://github.com/MichMich/MagicMirror/issues/1973) - Add backward compatibility for old module code in socketclient.js [#1973](https://github.com/MichMich/MagicMirror/issues/1973)
- Support multiple instances of calendar module with different config [#1109](https://github.com/MichMich/MagicMirror/issues/1109) - Support multiple instances of calendar module with different config [#1109](https://github.com/MichMich/MagicMirror/issues/1109)
- Fix the use of "maxNumberOfDays" in the module "weatherforecast" [#2018](https://github.com/MichMich/MagicMirror/issues/2018) - Fix the use of "maxNumberOfDays" in the module "weatherforecast" [#2018](https://github.com/MichMich/MagicMirror/issues/2018)
- Throw error when check_config fails [#1928](https://github.com/MichMich/MagicMirror/issues/1928)
## [2.11.0] - 2020-04-01 ## [2.11.0] - 2020-04-01

View File

@ -1,14 +1,10 @@
/* Magic Mirror /* Magic Mirror
* *
* Checker configuration file * Check the configuration file for errors
*
* By Rodrigo Ramírez Norambuena
* https://rodrigoramirez.com
* *
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed. * MIT Licensed.
*
*/ */
const Linter = require("eslint").Linter; const Linter = require("eslint").Linter;
const linter = new Linter(); const linter = new Linter();
@ -35,16 +31,19 @@ function getConfigFile() {
function checkConfigFile() { function checkConfigFile() {
const configFileName = getConfigFile(); const configFileName = getConfigFile();
// Check if file is present // Check if file is present
if (fs.existsSync(configFileName) === false) { if (fs.existsSync(configFileName) === false) {
Log.error(Utils.colors.error("File not found: "), configFileName); Log.error(Utils.colors.error("File not found: "), configFileName);
return; throw new Error("No config file present!");
} }
// check permission // check permission
try { try {
fs.accessSync(configFileName, fs.F_OK); fs.accessSync(configFileName, fs.F_OK);
} catch (e) { } catch (e) {
Log.log(Utils.colors.error(e)); Log.log(Utils.colors.error(e));
throw new Error("No permission to access config file!");
return; return;
} }
@ -65,6 +64,7 @@ function checkConfigFile() {
messages.forEach((error) => { messages.forEach((error) => {
Log.log("Line", error.line, "col", error.column, error.message); Log.log("Line", error.line, "col", error.column, error.message);
}); });
throw new Error("Wrong syntax in config file!");
} }
}); });
} }