hm2mqtt 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -96,7 +96,15 @@ function firstIp() {
96
96
 
97
97
  // the option's default is $STATE_DIRECTORY only, so --install does not freeze this fallback into the env file
98
98
  config.stateDir = config.stateDir || path.join(os.homedir(), '.hm2mqtt');
99
- fs.mkdirSync(config.stateDir, {recursive: true});
99
+ try {
100
+ fs.mkdirSync(config.stateDir, {recursive: true});
101
+ } catch (error) {
102
+ // a home directory that does not exist or a read-only filesystem: say which path and what to
103
+ // set, instead of an ENOENT stack trace from deep in node:fs
104
+ console.error(`error: cannot create the state directory ${config.stateDir}: ${error.message}`);
105
+ console.error('set --state-dir (HM2MQTT_STATE_DIR) to a writable path');
106
+ process.exit(1);
107
+ }
100
108
 
101
109
  let nameFile = {};
102
110
  if (config.nameFile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hm2mqtt",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "Interface between Homematic CCU and MQTT",
5
5
  "type": "module",
6
6
  "main": "index.js",