Skip to content

Commit d09a0ab

Browse files
Tee video effects errors to state (#2729)
1 parent 4b7486a commit d09a0ab

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "tee video effects errors to state",
4+
"packageName": "@azure/communication-react",
5+
"email": "2684369+JamesBurnside@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "tee video effects errors to state",
4+
"packageName": "@azure/communication-react",
5+
"email": "2684369+JamesBurnside@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/calling-stateful-client/src/CallContext.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,21 @@ export class CallContext {
744744
};
745745
}
746746

747+
/**
748+
* Tees direct errors to state.
749+
* @remarks
750+
* This is typically used for errors that are caught and intended to be shown to the user.
751+
*
752+
* @param error The raw error to report.
753+
* @param target The error target to tee error to.
754+
*
755+
* @private
756+
*/
757+
public teeErrorToState = (error: Error, target: CallErrorTarget): void => {
758+
const callError = toCallError(target, error);
759+
this.setLatestError(target, callError);
760+
};
761+
747762
private setLatestError(target: CallErrorTarget, error: CallError): void {
748763
this.modifyState((draft: CallClientState) => {
749764
draft.latestErrors[target] = error;

packages/calling-stateful-client/src/LocalVideoStreamVideoEffectsSubscriber.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ export class LocalVideoStreamVideoEffectsSubscriber {
6767
this.updateEffectsState({
6868
isActive: false
6969
});
70-
// TODO [video-background-effects]: future PR will tee error to state
71-
console.error(
72-
`LocalVideoStreamVideoEffectsSubscriber effectError: Method not fully implemented. Error needs teed to state. ${error}`
73-
);
70+
this._context.teeErrorToState(new Error(error.message), 'VideoEffectsFeature.startEffects');
7471
};
7572

7673
private updateEffectsState = (newEffectsState: LocalVideoStreamVideoEffectsState): void => {

0 commit comments

Comments
 (0)