Skip to content

Commit c818515

Browse files
committed
refactor: update error handling to use optional chaining
1 parent 5cadff3 commit c818515

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/loro-adaptors/src/loro-adaptor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class LoroAdaptor implements CrdtDocAdaptor {
118118
this.ctx?.send([updates]);
119119
}
120120
} catch (error) {
121-
this.ctx!.onJoinFailed(
121+
this.ctx?.onJoinFailed(
122122
error instanceof Error ? error.message : String(error)
123123
);
124124
throw error;
@@ -138,7 +138,7 @@ export class LoroAdaptor implements CrdtDocAdaptor {
138138
error instanceof Error ? error : new Error(String(error)),
139139
updates
140140
);
141-
this.ctx!.onImportError(
141+
this.ctx?.onImportError(
142142
error instanceof Error ? error : new Error(String(error)),
143143
updates
144144
);

0 commit comments

Comments
 (0)