Skip to content

Commit

Permalink
Merge pull request abpframework#11615 from abpframework/EngincanV/err…
Browse files Browse the repository at this point in the history
…or-handling-blazor

Docs: Add note for Blazor Server Error Handling
  • Loading branch information
hikalkan authored Feb 24, 2022
2 parents f507c09 + 057bfc2 commit 448d15f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/en/UI/Blazor/Error-Handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ There are different type of `Exception` classes handled differently by the ABP F

`UserFriendlyException` is a special type of exception. You can directly show a error message dialog to the user by throwing such an exception.

> For Blazor Server, exceptions must be handled manually. Otherwise it crashes the whole application. Auto Exception Handling is not possible with Blazor Server right now, please follow [this issue](https://github.com/abpframework/abp/issues/8195) to see progress. In meantime, you can use try-catch blocks and call the `HandleErrorAsync` method of ABP to handle errors manually, which shows an error dialog for you.
**Example**

````csharp
Expand All @@ -26,10 +28,24 @@ There are different type of `Exception` classes handled differently by the ABP F

@code
{
//for Blazor WASM
private void TestException()
{
throw new UserFriendlyException("A user friendly error message!");
}

//for Blazor Server
private async Task TestException()
{
try
{
throw new UserFriendlyException("A user friendly error message!");
}
catch(UserFriendlyException ex)
{
await HandleErrorAsync(ex);
}
}
}
````

Expand Down

0 comments on commit 448d15f

Please sign in to comment.