forked from tomkerkhove/promitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exit gracefully if a validation error occurs
I've tweaked the way that the startup process for Promitor works so that it runs the validation in the `Main()` method. This gives us the opportunity to exit gracefully if validation fails instead of throwing an exception. I've also added a new enum to track the possible exit statuses, and made sure that unhandled exceptions continue to use an exit code of `1`. Fixes tomkerkhove#1113
- Loading branch information
1 parent
8b3e730
commit 7ea559e
Showing
5 changed files
with
68 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Promitor.Agents.Scraper | ||
{ | ||
/// <summary> | ||
/// The different statuses that the agent scraper can exit with. | ||
/// </summary> | ||
public enum ExitStatus | ||
{ | ||
/// <summary> | ||
/// The application has run successfully. | ||
/// </summary> | ||
Success = 0, | ||
|
||
/// <summary> | ||
/// An unhandled exception was thrown during host startup. This probably | ||
/// indicates a bug in Promitor that should be reported. | ||
/// </summary> | ||
UnhandledException = 1, | ||
|
||
/// <summary> | ||
/// Validation failed, so Promitor can't start. | ||
/// </summary> | ||
ValidationFailed = 2 | ||
} | ||
} |
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