Skip to content

Commit

Permalink
try/catch error confirming dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
codymullins committed Jul 29, 2024
1 parent bb4ad5b commit c910cd1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Pure.Blazor.Components/Dialogs/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,24 @@ public async Task CloseDialogAsync(DialogInstance instance)

internal async Task<DialogEventResult> ConfirmDialogAsync(DialogInstance instance)
{
var res = await instance.ConfirmAsync();
if (res.Interrupted)
try
{
var res = await instance.ConfirmAsync();
if (res.Interrupted)
{
return res;
}

await CloseDialogAsync(instance);

return res;
}
catch (Exception ex)
{
log.LogError(ex, "Error confirming dialog");
}

await CloseDialogAsync(instance);

return res;
return new ();
}

public async Task CancelDialogAsync(DialogInstance instance)
Expand Down

0 comments on commit c910cd1

Please sign in to comment.