error handling

This commit is contained in:
Wolfgang Hottgenroth
2017-08-28 15:00:30 +02:00
parent 1cf6c76a7d
commit f44a7109b4
7 changed files with 132 additions and 12 deletions

16
dist/callchain.js vendored
View File

@ -38,7 +38,12 @@ class AAsyncBaseChainItem extends AChainItem {
}
this.addListener('yourturn', (message) => {
log.info(`Executing ${this.toString()}`);
this.func(message, this.next.send);
try {
this.func(message, this.next.send);
}
catch (e) {
log.error(`Chain interrupted: ${e}`);
}
});
}
}
@ -53,8 +58,13 @@ class ABaseChainItem extends AChainItem {
}
this.addListener('yourturn', (message) => {
log.info(`Executing ${this.toString()}`);
let result = this.func(message);
this.next.send(result);
try {
let result = this.func(message);
this.next.send(result);
}
catch (e) {
log.error(`Chain interrupted: ${e}`);
}
});
}
}