MegaBites-AI/Windows-powershell
0372
1// Licensed to the .NET Foundation under one or more agreements.2// The .NET Foundation licenses this file to you under the MIT license.3 4using System;5using System.Management.Automation.Internal;6 7namespace System.Management.Automation.ComInterop8{9 /// <summary>10 /// Strongly-typed and parameterized exception factory.11 /// </summary>12 internal static partial class Error13 {14 /// <summary>15 /// InvalidOperationException with message like "Marshal.SetComObjectData failed."16 /// </summary>17 internal static Exception SetComObjectDataFailed()18 {19 return new InvalidOperationException(ParserStrings.SetComObjectDataFailed);20 }21 22 /// <summary>23 /// InvalidOperationException with message like "Unexpected VarEnum {0}."24 /// </summary>25 internal static Exception UnexpectedVarEnum(object p0)26 {27 return new InvalidOperationException(StringUtil.Format(ParserStrings.UnexpectedVarEnum, p0));28 }29 30 /// <summary>31 /// System.Reflection.TargetParameterCountException with message like "Error while invoking {0}."32 /// </summary>33 internal static Exception DispBadParamCount(object p0, int parameterCount)34 {35 return new System.Reflection.TargetParameterCountException(StringUtil.Format(ParserStrings.DispBadParamCount, p0, parameterCount));36 }37 38 /// <summary>39 /// MissingMemberException with message like "Error while invoking {0}."40 /// </summary>41 internal static Exception DispMemberNotFound(object p0)42 {43 return new MissingMemberException(StringUtil.Format(ParserStrings.DispMemberNotFound, p0));44 }45 46 /// <summary>47 /// ArgumentException with message like "Error while invoking {0}. Named arguments are not supported."48 /// </summary>49 internal static Exception DispNoNamedArgs(object p0)50 {51 return new ArgumentException(StringUtil.Format(ParserStrings.DispNoNamedArgs, p0));52 }53 54 /// <summary>55 /// OverflowException with message like "Error while invoking {0}."56 /// </summary>57 internal static Exception DispOverflow(object p0)58 {59 return new OverflowException(StringUtil.Format(ParserStrings.DispOverflow, p0));60 }61 62 /// <summary>63 /// ArgumentException with message like "Could not convert argument {0} for call to {1}."64 /// </summary>65 internal static Exception DispTypeMismatch(object method, string value, string originalTypeName, string destinationTypeName)66 {67 return new ArgumentException(StringUtil.Format(ParserStrings.DispTypeMismatch, method, value, originalTypeName, destinationTypeName));68 }69 70 /// <summary>71 /// ArgumentException with message like "Error while invoking {0}. A required parameter was omitted."72 /// </summary>73 internal static Exception DispParamNotOptional(object p0)74 {75 return new ArgumentException(StringUtil.Format(ParserStrings.DispParamNotOptional, p0));76 }77 78 /// <summary>79 /// InvalidOperationException with message like "Cannot retrieve type information."80 /// </summary>81 internal static Exception CannotRetrieveTypeInformation()82 {83 return new InvalidOperationException(ParserStrings.CannotRetrieveTypeInformation);84 }85 86 /// <summary>87 /// ArgumentException with message like "IDispatch::GetIDsOfNames behaved unexpectedly for {0}."88 /// </summary>89 internal static Exception GetIDsOfNamesInvalid(object p0)90 {91 return new ArgumentException(StringUtil.Format(ParserStrings.GetIDsOfNamesInvalid, p0));92 }93 94 /// <summary>95 /// InvalidOperationException with message like "Attempting to pass an event handler of an unsupported type."96 /// </summary>97 internal static Exception UnsupportedHandlerType()98 {99 return new InvalidOperationException(ParserStrings.UnsupportedHandlerType);100 }101 102 /// <summary>103 /// MissingMemberException with message like "Could not get dispatch ID for {0} (error: {1})."104 /// </summary>105 internal static Exception CouldNotGetDispId(object p0, object p1)106 {107 return new MissingMemberException(StringUtil.Format(ParserStrings.CouldNotGetDispId, p0, p1));108 }109 110 /// <summary>111 /// System.Reflection.AmbiguousMatchException with message like "There are valid conversions from {0} to {1}."112 /// </summary>113 internal static Exception AmbiguousConversion(object p0, object p1)114 {115 return new System.Reflection.AmbiguousMatchException(StringUtil.Format(ParserStrings.AmbiguousConversion, p0, p1));116 }117 }118}119 