Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhandled exceptions #8

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Tell us what _actually_ happens

**Your environment**

Tell us more about your environment; such as, What OS are you running? What version of `git-ssh-sign` are you using? Etc.
Tell us more about your environment; such as, What OS are you running? What version of the binary are you using? Etc.

**Steps to reproduce**

Expand Down
17 changes: 13 additions & 4 deletions Keeper.WindowsCredentialManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ public static async Task<int> Main(string[] args)
setCommand.AddArgument(configArg);
setCommand.SetHandler((appName, configArg) =>
{
CredentialManager.WriteCredential(appName, Environment.UserName, Parsing.ParseConfig(configArg));
// Exit with success code
Environment.Exit(0);
try
{
var secret = Parsing.ParseConfig(configArg);
CredentialManager.WriteCredential(appName, Environment.UserName, secret);
// Exit with success code
Environment.Exit(0);
}
catch (ArgumentException e)
{
Console.Error.WriteLine(e.Message);
Environment.Exit(1);
}
}, appName, configArg);

getCommand.AddArgument(appName);
Expand All @@ -47,7 +56,7 @@ public static async Task<int> Main(string[] args)
// Output cred to stdout and exit with success code
if (cred == null)
{
Console.WriteLine("No KSM Config found for the given application name.");
Console.Error.WriteLine("No KSM Config found for the given application name.");
Environment.Exit(1);
}
Console.WriteLine(cred.Password);
Expand Down