Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZeroInstall.Client: Map exit codes to exception types
- Loading branch information
1 parent
803202d
commit 660a11f
Showing
6 changed files
with
64 additions
and
92 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright Bastian Eicher et al. | ||
// Licensed under the GNU Lesser Public License | ||
|
||
using NanoByte.Common.Streams; | ||
|
||
namespace ZeroInstall.Client; | ||
|
||
/// <summary> | ||
/// Runs Zero Install as a sub/child process. | ||
/// </summary> | ||
internal class ZeroInstallProcess : SubProcess | ||
{ | ||
public ZeroInstallProcess(string commandLine) | ||
: base(ProcessUtils.FromCommandLine(commandLine)) | ||
{} | ||
|
||
protected override void HandleExitCode(int exitCode) | ||
{ | ||
switch (exitCode) | ||
{ | ||
case 1: // No changes | ||
break; | ||
case 10: // Web error | ||
throw new WebException(); | ||
case 11: // Access denied | ||
throw new UnauthorizedAccessException(); | ||
case 12: // IO error | ||
throw new IOException(); | ||
case 100: // User canceled | ||
throw new OperationCanceledException(); | ||
default: | ||
base.HandleExitCode(exitCode); | ||
return; | ||
} | ||
} | ||
} |
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