ensure errors caught by boundary are logged in calls code

This commit is contained in:
Bruno Windels 2023-01-19 11:30:23 +01:00
parent bf9c868c8b
commit 3842f450dd
2 changed files with 10 additions and 0 deletions

View File

@ -94,6 +94,11 @@ export class GroupCall extends EventEmitter<{change: never}> {
/** Set between calling join and leave. */ /** Set between calling join and leave. */
private joinedData?: JoinedData; private joinedData?: JoinedData;
private errorBoundary = new ErrorBoundary(err => { private errorBoundary = new ErrorBoundary(err => {
if (this.joinedData) {
// in case the error happens in code that does not log,
// log it here to make sure it isn't swallowed
this.joinedData.logItem.log("error at boundary").catch(err);
}
this.emitChange(); this.emitChange();
}); });

View File

@ -97,6 +97,11 @@ export class Member {
private expireTimeout?: Timeout; private expireTimeout?: Timeout;
private errorBoundary = new ErrorBoundary(err => { private errorBoundary = new ErrorBoundary(err => {
this.options.emitUpdate(this, "error"); this.options.emitUpdate(this, "error");
if (this.connection) {
// in case the error happens in code that does not log,
// log it here to make sure it isn't swallowed
this.connection.logItem.log("error at boundary").catch(err);
}
}); });
constructor( constructor(