Skip to content

Commit

Permalink
Add appropriate alert message when trying to add by hostname on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
georg-jung committed Dec 13, 2019
1 parent 48a1501 commit 6293efb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion WoL/Pages/AddHost.razor
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,16 @@
{
host = await GetHost();
}
catch (DllNotFoundException ex)
{
L.LogInformation(ex, $"DllNotFound during name resolution or determination of mac address. Page: {nameof(AddHost)}");
Alert = "This operation is not supported on the operating system this application is running on. Adding hosts by hostname is currently not supported on linux due to the lack of an apropriate ARP API.";
Creating = false;
return;
}
catch (Exception ex)
{
L.LogInformation(ex, $"Exception during name resolution or determination of mac address. Page: {nameof(AddHost)}");
L.LogDebug(ex, $"Exception during name resolution or determination of mac address. Page: {nameof(AddHost)}");
Alert = "This hostname or it's mac address could not be found.";
Creating = false;
return;
Expand Down
2 changes: 1 addition & 1 deletion WoL/Services/DnsPingServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DnsPingServiceBase(IAddressLookupService addressLookupService, ILogger lo
catch (Exception ex)
#pragma warning restore CA1031 // Keine allgemeinen Ausnahmetypen abfangen
{
logger.LogInformation(ex, $"Exception during {nameof(IAddressLookupService)}.{nameof(IAddressLookupService.GetIpAndName)}");
logger.LogDebug(ex, $"Exception during {nameof(IAddressLookupService)}.{nameof(IAddressLookupService.GetIpAndName)}");
return PingResult.HostNotFound;
}
return await IsReachable(ip, timeout).ConfigureAwait(false) ? PingResult.Success : PingResult.Unreachable;
Expand Down

0 comments on commit 6293efb

Please sign in to comment.