Switch to using notifications for errors

dhcp-server
Pat Hartl 2023-09-01 00:29:26 -05:00
parent 685f7bf91d
commit 688979f283
1 changed files with 8 additions and 9 deletions

View File

@ -1,6 +1,7 @@
@inject ServerService ServerService
@inject ServerProcessService ServerProcessService
@inject IMessageService MessageService
@inject INotificationService NotificationService
@implements IAsyncDisposable
<Space Size="@("large")">
@ -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()