winget-cli

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

UnitPropertyUnsupportedException.cs (1922B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="UnitPropertyUnsupportedException.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.Management.Configuration.Processor.Exceptions
      8 {
      9     using System;
     10 
     11     /// <summary>
     12     /// The property type of a unit is not supported.
     13     /// </summary>
     14     internal class UnitPropertyUnsupportedException : Exception
     15     {
     16         /// <summary>
     17         /// Initializes a new instance of the <see cref="UnitPropertyUnsupportedException"/> class.
     18         /// </summary>
     19         /// <param name="name">Name.</param>
     20         /// <param name="type">Type.</param>
     21         /// <param name="inner">Inner exception.</param>
     22         public UnitPropertyUnsupportedException(string name, Type type, Exception inner)
     23             : base($"Property {name} of type {type.FullName} is not supported.", inner)
     24         {
     25             this.HResult = ErrorCodes.WinGetConfigUnitUnsupportedType;
     26             this.Name = name;
     27             this.Type = type;
     28         }
     29 
     30         /// <summary>
     31         /// Initializes a new instance of the <see cref="UnitPropertyUnsupportedException"/> class.
     32         /// </summary>
     33         /// <param name="type">Type.</param>
     34         public UnitPropertyUnsupportedException(Type type)
     35             : base($"Type {type.FullName} is not supported.")
     36         {
     37             this.HResult = ErrorCodes.WinGetConfigUnitUnsupportedType;
     38             this.Type = type;
     39         }
     40 
     41         /// <summary>
     42         /// Gets the name.
     43         /// </summary>
     44         public string? Name { get; }
     45 
     46         /// <summary>
     47         /// Gets the type.
     48         /// </summary>
     49         public Type Type { get; }
     50     }
     51 }