Skip to content

Commit cdfbe67

Browse files
Merge pull request #240 from TimeWarpEngineering/Cramer/2020-12-10/LogLevelAndTestApp
Change the Loggin Level to Warning on CloneStateBehavior
2 parents 4fe38ed + ce40597 commit cdfbe67

5 files changed

Lines changed: 17 additions & 8 deletions

File tree

Source/BlazorState/Pipeline/CloneState/CloneStateBehavior.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ RequestHandlerDelegate<TResponse> aNext
7575
// Maybe if error occurs on one action we want to launch another action to
7676
// Update some error state so the user knows of the failure.
7777
// But as a rule if this is an exception it should be unexpected.
78-
Logger.LogError($"{className}: Error: {aException.Message}");
79-
Logger.LogError($"{className}: InnerError: {aException?.InnerException?.Message}");
80-
Logger.LogError($"{className}: Restoring State of type: {declaringType}");
78+
Logger.LogWarning($"{className}: Error: {aException.Message}");
79+
Logger.LogWarning($"{className}: InnerError: {aException?.InnerException?.Message}");
80+
Logger.LogWarning($"{className}: Restoring State of type: {declaringType}");
8181

8282
if (!IsApiCallException(aException) && originalState != null)
8383
{

Tests/TestApp/Client/Features/Application/Notification/ExceptionNotificationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Task Handle
3232
CancellationToken aCancellationToken
3333
)
3434
{
35-
//Logger.LogDebug(aExceptionNotification.Request.GetType().Name);
35+
Logger.LogWarning($"aExceptionNotification.Exception.Message: {aExceptionNotification.Exception.Message}");
3636
ApplicationState.ExceptionMessage = aExceptionNotification.Exception.Message;
3737
return Unit.Task;
3838
}

Tests/TestApp/Client/Pages/CounterPage.razor

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@
1717
<br />
1818
<hr />
1919
<h6>Click below to send a Change Route Request that should take back to home page.</h6>
20-
<button class="btn btn-primary" data-qa="ChangeRoute" @onclick="ButtonClick">Change Route to Home</button>
20+
<button class="btn btn-primary" data-qa="ChangeRoute" @onclick=ChangeRouteToHome>Change Route to Home</button>
2121

2222
<br />
2323
<hr />
2424
<h6>Click below to send a IncrementCountAction via JsInterop.</h6>
2525
<button class="btn btn-primary" data-qa="JsInterop" onclick="window.InteropTest()">Increment Count by 7 via JavaScript Interop</button>
2626

27+
<br />
28+
<hr />
29+
<h6>Click below to Throw and exception that will roll back state.</h6>
30+
<button class="btn btn-primary" data-qa="ThrowException" @onclick=SendThrowExceptionAction>Send Throw Exception Action</button>
31+
2732
<br />
2833
<hr />
2934
<h6>EventStream is an example of middleware. It adds each action to list.</h6>

Tests/TestApp/Client/Pages/CounterPage.razor.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ namespace TestApp.Client.Pages
33
using BlazorState.Features.Routing;
44
using System.Threading.Tasks;
55
using TestApp.Client.Features.Base.Components;
6+
using static TestApp.Client.Features.Counter.CounterState;
67

78
public class CounterPageBase : BaseComponent
89
{
9-
protected async Task ButtonClick() =>
10-
_ = await Mediator.Send(new RouteState.ChangeRouteAction { NewRoute = "/" });
10+
protected async Task ChangeRouteToHome() =>
11+
await Mediator.Send(new RouteState.ChangeRouteAction { NewRoute = "/" });
12+
13+
protected async Task SendThrowExceptionAction() =>
14+
await Mediator.Send(new ThrowExceptionAction());
1115
}
1216
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "3.1.402",
3+
"version": "3.1.404",
44
"rollForward": "latestFeature"
55
}
66
}

0 commit comments

Comments
 (0)