-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#115 chore: added error handling for unhandled exceptions and a lifet…
…ime service + Added an ExtendedException which provides clues about how to solve a specific error + The lifetime service manages the lifetime of the web app. It loads the configuration and start the interfaces at the beginning, and stop the interfaces when it's shutting down + Renamed TrafficInfo.razor to RealTimeTraffic.razor for better understanding + Replaced async void methods with async Task for best practices + Fixed a bug with the interface property of AddInterface.razor. It must be set only once, and it was a getter only property which was being generated with every call
- Loading branch information
1 parent
49a441b
commit c385c4d
Showing
21 changed files
with
262 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Linguard.Core.Exceptions; | ||
|
||
public abstract class ExtendedException : Exception { | ||
protected ExtendedException(IEnumerable<string> fixes) { | ||
Fixes = fixes; | ||
} | ||
protected ExtendedException(string message, IEnumerable<string> fixes) : base(message) { | ||
Fixes = fixes; | ||
} | ||
protected ExtendedException(string message, Exception innerException, IEnumerable<string> fixes) | ||
: base(message, innerException) { | ||
Fixes = fixes; | ||
} | ||
|
||
public IEnumerable<string> Fixes { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
namespace Linguard.Core.Services.Exceptions; | ||
using Linguard.Core.Exceptions; | ||
using Linguard.Core.Utils; | ||
|
||
public class WireguardException : Exception { | ||
public WireguardException() {} | ||
public WireguardException(string message) : base(message) {} | ||
public WireguardException(string message, Exception innerException) : base(message, innerException) {} | ||
namespace Linguard.Core.Services.Exceptions; | ||
|
||
public class WireguardException : ExtendedException { | ||
|
||
private static readonly string[] _fixes = { | ||
"Verify that your Wireguard settings are correct.", | ||
$"Ensure the user running {AssemblyInfo.Product} is able to run Wireguard as super user." | ||
}; | ||
public WireguardException() : base(_fixes) {} | ||
public WireguardException(string message) : base(message, _fixes) {} | ||
public WireguardException(string message, Exception innerException) : base(message, innerException, _fixes) {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Linguard.Web.Services; | ||
|
||
public interface ILifetimeService { | ||
void OnAppStarted(); | ||
void OnAppStopping(); | ||
void OnAppStopped(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.