Skip to content

Commit fdf4486

Browse files
committed
* (Apollon77) Catch error case when npm istallation fails (Sentry IOBROKER-JAVASCRIPT-3K)
* (Apollon77) Prevent crash case in mirroring (Sentry IOBROKER-JAVASCRIPT-3M)
1 parent 5cd3033 commit fdf4486

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ And then call "npm run build".
3939
### __WORK IN PROGRESS__
4040
-->
4141
## Changelog
42+
### __WORK IN PROGRESS__
43+
* (Apollon77) Catch error case when npm istallation fails (Sentry IOBROKER-JAVASCRIPT-3K)
44+
* (Apollon77) Prevent crash case in mirroring (Sentry IOBROKER-JAVASCRIPT-3M)
45+
4246
### 4.6.25 (2020-08-24)
4347
* (bluefox) Fixed the loading of page
4448

lib/mirror.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ class Mirror {
222222
if (objects[o] === files[f]) {
223223
const id = dirDB + '.' + objects[o];
224224

225+
if (!this.diskList[id]) {
226+
continue;
227+
}
228+
225229
if (!this.dbList[id].ts || (this.dbList[id].ts > this.diskList[id].ts && this.dbList[id].ts - this.diskList[id].ts > 2000)) {
226230
// copy text to file
227231
this.dbList[id].ts = Date.now();

main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,12 +1214,19 @@ function installNpm(npmLib, callback) {
12141214
child.stderr.on('data', buf =>
12151215
adapter.log.error(buf.toString('utf8')));
12161216

1217+
child.on('err', err => {
1218+
adapter.log.error('Cannot install ' + npmLib + ': ' + err);
1219+
if (typeof callback === 'function') callback(npmLib);
1220+
callback = null;
1221+
});
1222+
12171223
child.on('exit', (code /* , signal */) => {
12181224
if (code) {
12191225
adapter.log.error('Cannot install ' + npmLib + ': ' + code);
12201226
}
12211227
// command succeeded
12221228
if (typeof callback === 'function') callback(npmLib);
1229+
callback = null;
12231230
});
12241231
}
12251232

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"dependencies": {
3232
"@iobroker/adapter-core": "^2.4.0",
33-
"@types/node": "^10.17.28",
33+
"@types/node": "^12.12.54",
3434
"@types/request": "^2.48.5",
3535
"coffee-compiler": "^0.3.2",
3636
"coffee-script": "^1.12.7",

0 commit comments

Comments
 (0)