-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from astankov2/master
Check if an exception is client-side by checking if the exception source is a registered assembly in CloneStateBehavior
- Loading branch information
Showing
6 changed files
with
60 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ pr: none | |
variables: | ||
Major: 3 | ||
Minor: 4 | ||
Patch: 2 | ||
Patch: 3 | ||
DotNetSdkVersion: 3.1.404 | ||
|
||
stages: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...lient/Features/Counter/Actions/ThrowServerSideException/ThrowServerSideExceptionAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace TestApp.Client.Features.Counter | ||
{ | ||
using BlazorState; | ||
|
||
public partial class CounterState | ||
{ | ||
public class ThrowServerSideExceptionAction : IAction | ||
{ | ||
public string Message { get; set; } | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...ient/Features/Counter/Actions/ThrowServerSideException/ThrowServerSideExceptionHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace TestApp.Client.Features.Counter | ||
{ | ||
using BlazorState; | ||
using MediatR; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using TestApp.Client.Features.Base; | ||
|
||
public partial class CounterState | ||
{ | ||
internal class ThrowServerSideExceptionHandler : BaseHandler<ThrowServerSideExceptionAction> | ||
{ | ||
public ThrowServerSideExceptionHandler(IStore aStore) : base(aStore) { } | ||
|
||
/// <summary> | ||
/// Intentionally throw so we can test exception handling. | ||
/// </summary> | ||
/// <param name="aThrowServerSideExceptionAction"></param> | ||
/// <param name="aCancellationToken"></param> | ||
/// <returns></returns> | ||
public override Task<Unit> Handle | ||
( | ||
ThrowServerSideExceptionAction aThrowServerSideExceptionAction, | ||
CancellationToken aCancellationToken | ||
) => throw new HttpRequestException(aThrowServerSideExceptionAction.Message) | ||
{ | ||
Source = $"{nameof(TestApp)}.Server" | ||
}; | ||
} | ||
} | ||
} |