diff --git a/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs b/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs index 4cc365f7b35..f814abcdfd0 100644 --- a/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs +++ b/src/BootstrapBlazor/Components/ErrorLogger/BootstrapBlazorErrorBoundary.cs @@ -26,6 +26,10 @@ class BootstrapBlazorErrorBoundary : ErrorBoundaryBase [NotNull] private ToastService? ToastService { get; set; } + [Inject] + [NotNull] + private NavigationManager? NavigationManager { get; set; } + /// /// 获得/设置 自定义错误处理回调方法 /// @@ -65,7 +69,7 @@ protected override async Task OnErrorAsync(Exception exception) await ToastService.Error(ToastTitle, exception.Message); } - Logger.LogError(exception, "{BootstrapBlazorErrorBoundary} {OnErrorAsync} log this error", nameof(BootstrapBlazorErrorBoundary), nameof(OnErrorAsync)); + Logger.LogError(exception, "{BootstrapBlazorErrorBoundary} {OnErrorAsync} log this error occurred at {Page}", nameof(BootstrapBlazorErrorBoundary), nameof(OnErrorAsync), NavigationManager.Uri); } }