diff --git a/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor b/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor new file mode 100644 index 00000000000..a5e396cf306 --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor @@ -0,0 +1,3 @@ +@page "/error-page" + +

ErrorPage

diff --git a/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor.cs b/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor.cs new file mode 100644 index 00000000000..23cf221f0bb --- /dev/null +++ b/src/BootstrapBlazor.Server/Components/Pages/ErrorPage.razor.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the Apache 2.0 License +// See the LICENSE file in the project root for more information. +// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone + +namespace BootstrapBlazor.Server.Components.Pages; + +/// +/// ErrorPage 组件用于测试全局异常处理功能 +/// +public partial class ErrorPage +{ + /// + /// + /// + protected override void OnInitialized() + { + base.OnInitialized(); + + var a = 1; + var b = 0; + + // 这里会抛出异常 + var c = a / b; + } +} diff --git a/src/BootstrapBlazor.Server/Components/Samples/GlobalException.razor b/src/BootstrapBlazor.Server/Components/Samples/GlobalException.razor index 1944521cfbd..6bdb3ac42b5 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/GlobalException.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/GlobalException.razor @@ -72,4 +72,8 @@