Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Error event in Blazor ViewModel (#3279) #3915

Merged

Conversation

rrrooommmaaa
Copy link
Contributor

Close #3279

await vm.SaveAsync();

// Assert
Assert.AreEqual("Inserted", TestResults.GetResult("FakePerson"));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is problem using TestResults for this test. It's probably due to multiple ConfigureAwait(false) that AsyncLocal is sometimes addressed from different execution contexts.
I'd wire a dedicated variable in the test and a handler to update variable.
Thoughts?

@@ -284,6 +288,8 @@ public async Task SaveAsync()
{
HookChangedEvents(Model);
IsBusy = false;
if (Exception != null)
Error?.Invoke();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the event should provide the exception to the handler as a parameter.

I know the value is a property on the viewmodel, but it would be simpler for the person writing the event handler to just get the exception directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@rockfordlhotka rockfordlhotka added the pr/NeedContributorAgreement Need contributor agreement label May 5, 2024
@rockfordlhotka
Copy link
Member

@rrrooommmaaa thank you for the updates to the PR. We do still need your contributor agreement.

https://github.com/MarimerLLC/csla/blob/main/CONTRIBUTING.md

@rrrooommmaaa rrrooommmaaa marked this pull request as ready for review May 6, 2024 13:06
@rrrooommmaaa
Copy link
Contributor Author

https://github.com/MarimerLLC/csla/blob/main/CONTRIBUTING.md

I have just sent it to you via e-mail.

@rockfordlhotka rockfordlhotka removed the pr/NeedContributorAgreement Need contributor agreement label May 6, 2024
@rockfordlhotka rockfordlhotka merged commit db84ef0 into MarimerLLC:main May 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an OnError Event to the Blazor ViewModel
2 participants