Skip to content

Commit e80ffb1

Browse files
committed
refactor: 增加异常处理逻辑
1 parent 1ab1ba2 commit e80ffb1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/BootstrapBlazor/Extensions/JSModuleExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string
5050
{
5151
jSObjectReference = await jsRuntime.InvokeAsync<IJSObjectReference>(identifier: "import", fileName);
5252
}
53+
catch (JSDisconnectedException) { }
5354
catch (JSException)
5455
{
5556
#if DEBUG
@@ -58,6 +59,7 @@ public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string
5859
#endif
5960
}
6061
catch (OperationCanceledException) { }
62+
catch (ObjectDisposedException) { }
6163
return new JSModule(jSObjectReference);
6264
}
6365

0 commit comments

Comments
 (0)