From 688979f2832e8a27acfb189161d3d6a2c416a1c4 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Fri, 1 Sep 2023 00:29:26 -0500 Subject: [PATCH] Switch to using notifications for errors --- .../Servers/Components/ServerControl.razor | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/LANCommander/Pages/Servers/Components/ServerControl.razor b/LANCommander/Pages/Servers/Components/ServerControl.razor index 0a61363..578c5e1 100644 --- a/LANCommander/Pages/Servers/Components/ServerControl.razor +++ b/LANCommander/Pages/Servers/Components/ServerControl.razor @@ -1,6 +1,7 @@ @inject ServerService ServerService @inject ServerProcessService ServerProcessService @inject IMessageService MessageService +@inject INotificationService NotificationService @implements IAsyncDisposable @@ -84,21 +85,19 @@ if (Status == ServerProcessStatus.Error) { - MessageService.Error("There was an unexpected error while trying to start the server."); + NotificationService.Error(new NotificationConfig + { + Message = $"Error starting server {args.Server.Name}", + Description = args.Exception.Message, + } + ); } } } private async Task Start() { - try - { - await ServerProcessService.StartServerAsync(Server); - } - catch (Exception ex) - { - await MessageService.Error("There was an unexpected error while trying to start the server."); - } + ServerProcessService.StartServerAsync(Server); } private void Stop()