winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

WinGetCLIException.cs (2151B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="WinGetCLIException.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.WinGet.Client.Engine.Exceptions
      8 {
      9     using System.Management.Automation;
     10     using Microsoft.WinGet.Resources;
     11 
     12     /// <summary>
     13     /// WinGet cli exception.
     14     /// </summary>
     15     public class WinGetCLIException : RuntimeException
     16     {
     17         /// <summary>
     18         /// Initializes a new instance of the <see cref="WinGetCLIException"/> class.
     19         /// </summary>
     20         /// <param name="command">Command.</param>
     21         /// <param name="parameters">Parameters.</param>
     22         /// <param name="exitCode">Exit code.</param>
     23         /// <param name="stdOut">Standard output.</param>
     24         /// <param name="stdErr">Standard error.</param>
     25         public WinGetCLIException(string command, string? parameters, int exitCode, string stdOut, string stdErr)
     26             : base(string.Format(Resources.WinGetCLIExceptionMessage, command, parameters, exitCode))
     27         {
     28             this.Command = command;
     29             this.Parameters = parameters;
     30             this.ExitCode = exitCode;
     31             this.StdOut = stdOut;
     32             this.StdErr = stdErr;
     33         }
     34 
     35         /// <summary>
     36         /// Gets the command.
     37         /// </summary>
     38         public string Command { get; private set; }
     39 
     40         /// <summary>
     41         /// Gets the parameters.
     42         /// </summary>
     43         public string? Parameters { get; private set; }
     44 
     45         /// <summary>
     46         /// Gets the exit code.
     47         /// </summary>
     48         public int ExitCode { get; private set; }
     49 
     50         /// <summary>
     51         /// Gets the standard output.
     52         /// </summary>
     53         public string StdOut { get; private set; }
     54 
     55         /// <summary>
     56         /// Gets the standard error.
     57         /// </summary>
     58         public string StdErr { get; private set; }
     59     }
     60 }