Exemple #1
0
        public static string GetExceptionMessage(ExceptionMessageId message, params string[] replacements)
        {
            switch (message)
            {
            case  ExceptionMessageId.GenericParameterFailureException:
                return(string.Format(Resources.AE_GenericParameterFailureException, replacements));

            case ExceptionMessageId.TypeParameterInfoError:
                return(string.Format(Resources.AE_TypeParameterInfoError, replacements));

            case ExceptionMessageId.TypeMustBeCompilerGenerated:
                return(string.Format(Resources.AE_TypeMustBeCompilerGenerated, replacements));

            case ExceptionMessageId.TypeMustBeGenericChild:
                return(string.Format(Resources.AE_TypeMustBeGenericChild, replacements));

            case ExceptionMessageId.TypeMustBeStaticClass:
                return(string.Format(Resources.AE_TypeMustBeStaticClass, replacements));

            case ExceptionMessageId.TypeNotGeneric:
                return(string.Format(Resources.AE_TypeNotGeneric, replacements));

            case ExceptionMessageId.UnknownArgument:
                return(string.Format(Resources.AE_UnknownArgument, replacements));

            case ExceptionMessageId.UnknownArgumentMessage:
                return(string.Format(Resources.AE_UnknownArgumentMessage, replacements));

            default:
                throw ObtainArgumentException(ArgumentWithException.message, ExceptionMessageId.UnknownArgumentMessage);
            }
        }
 internal SqlBuildException(ExceptionMessageId messageId, string sql, int lineNumber, int position) :
     base(messageId, sql, lineNumber, position)
 {
     Sql        = sql;
     LineNumber = lineNumber;
     Position   = position;
 }
 internal SqlBuildException(ExceptionMessageId messageId, string sql, int lineNumber, int position,
                            string variableComment) :
     base(messageId, sql, lineNumber, position, variableComment)
 {
     Sql             = sql;
     LineNumber      = lineNumber;
     Position        = position;
     VariableComment = variableComment;
 }
Exemple #4
0
 internal SqlParseException(ExceptionMessageId messageId, string sql, int lineNumber, int position,
                            string variableComment, string testValue) :
     base(messageId, sql, lineNumber, position, variableComment, testValue)
 {
     Sql             = sql;
     LineNumber      = lineNumber;
     Position        = position;
     VariableComment = variableComment;
     TestValue       = testValue;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpressionEvaluateException"/> class.
 /// </summary>
 /// <param name="messageId"></param>
 /// <param name="expressionText"></param>
 /// <param name="current"></param>
 /// <param name="next"></param>
 internal ExpressionEvaluateException(ExceptionMessageId messageId, string expressionText, char current,
                                      char next) :
     base(messageId, expressionText, current, next)
 {
     ExpressionText = expressionText;
     if (next == '\0' || char.IsWhiteSpace(next))
     {
         InvalidOperator = $"{current}";
     }
     else
     {
         InvalidOperator = $"{current}{next}";
     }
 }
Exemple #6
0
        private static string GetExceptionMessage(ExceptionMessageId message, params string[] replacements)
        {
            switch (message)
            {
            case ExceptionMessageId.DelegateTypeParameterMismatch:
                return(string.Format(CultureInfo.InvariantCulture, Resources.AE_DelegateTypeParameterMismatch, replacements));

            case ExceptionMessageId.TypeMustBeGenericParameter:
                return(string.Format(CultureInfo.InvariantCulture, Resources.AE_TypeMustBeGenericParameter, replacements));

            case ExceptionMessageId.UnknownArgument:
                return(string.Format(CultureInfo.InvariantCulture, Resources.AE_UnknownArgument, replacements));

            case ExceptionMessageId.UnknownArgumentMessage:
                return(string.Format(CultureInfo.InvariantCulture, Resources.AE_UnknownArgumentMessage, replacements));

            default:
                throw ObtainArgumentException(ArgumentWithException.message, ExceptionMessageId.UnknownArgumentMessage);
            }
        }
Exemple #7
0
 public static ArgumentException ObtainArgumentException(ArgumentWithException argument, ExceptionMessageId message)
 {
     return(ObtainArgumentException(argument, message, emptyReplacements));
 }
Exemple #8
0
 public static NotSupportedException ObtainNotSupportedException(ExceptionMessageId message, params string[] replacements)
 {
     return(new NotSupportedException(GetExceptionMessage(message, replacements ?? emptyReplacements)));
 }
Exemple #9
0
 public static NotSupportedException ObtainNotSupportedException(ExceptionMessageId message, string replacement1, string replacement2, string replacement3)
 {
     return(new NotSupportedException(GetExceptionMessage(message, new[] { replacement1, replacement2, replacement3 })));
 }
 /// <summary>
 /// Create a new EspException instance
 /// </summary>
 /// <param name="messageId"></param>
 /// <param name="args"></param>
 public EspException(ExceptionMessageId messageId, params object[] args) :
     base(ExceptionMessageIdHelper.ToMessage(messageId, args))
 {
     MessageId = messageId;
     Arguments = args;
 }
Exemple #11
0
 internal InvalidSqlFileException(ExceptionMessageId messageId, string sqlFilePath)
     : base(messageId, sqlFilePath)
 {
     SqlFilePath = sqlFilePath;
 }
 internal InvalidSqlParserConfigException(ExceptionMessageId messageId) :
     base(messageId)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpressionEvaluateException"/> class.
 /// </summary>
 /// <param name="messageId"></param>
 /// <param name="expressionText"></param>
 /// <param name="current"></param>
 internal ExpressionEvaluateException(ExceptionMessageId messageId, string expressionText, char current) :
     base(messageId, expressionText, current)
 {
     ExpressionText = expressionText;
 }
 internal ExpressionEvaluateException(ExceptionMessageId messageId, string expressionText, object value) :
     base(messageId, expressionText, value)
 {
     ExpressionText = expressionText;
 }
 internal UnsupportedSqlCommentException(ExceptionMessageId messageId, string nodeName) :
     base(messageId, nodeName)
 {
 }
Exemple #16
0
 public static ArgumentException ObtainArgumentException(ArgumentWithException argument, ExceptionMessageId message, string replacement1, string replacement2, string replacement3)
 {
     return(ObtainArgumentException(argument, message, new[] { replacement1, replacement2, replacement3 }));
 }
Exemple #17
0
 public static ArgumentException ObtainArgumentException(ArgumentWithException argument, ExceptionMessageId message, params string[] replacements)
 {
     return(new ArgumentException(GetExceptionMessage(message, replacements ?? emptyReplacements), GetArgumentName(argument)));
 }
 internal SqlTransformException(ExceptionMessageId messageId) :
     base(messageId)
 {
 }
Exemple #19
0
        internal static string ToMessage(ExceptionMessageId messageId, params object[] args)
        {
            switch (messageId)
            {
                #region SqlParseException
            case ExceptionMessageId.Esp2101:
                return(string.Format(MessageFormat.Esp2101, args));

            case ExceptionMessageId.Esp2102:
                return(string.Format(MessageFormat.Esp2102, args));

            case ExceptionMessageId.Esp2104:
                return(string.Format(MessageFormat.Esp2104, args));

            case ExceptionMessageId.Esp2109:
                return(string.Format(MessageFormat.Esp2109, args));

            case ExceptionMessageId.Esp2110:
                return(string.Format(MessageFormat.Esp2110, args));

            case ExceptionMessageId.Esp2119:
                return(string.Format(MessageFormat.Esp2119, args));

            case ExceptionMessageId.Esp2120:
                return(string.Format(MessageFormat.Esp2120, args));

            case ExceptionMessageId.Esp2121:
                return(string.Format(MessageFormat.Esp2121, args));

            case ExceptionMessageId.Esp2133:
                return(string.Format(MessageFormat.Esp2133, args));

            case ExceptionMessageId.Esp2134:
                return(string.Format(MessageFormat.Esp2134, args));

            case ExceptionMessageId.Esp2135:
                return(string.Format(MessageFormat.Esp2135, args));

            case ExceptionMessageId.Esp2138:
                return(string.Format(MessageFormat.Esp2138, args));

            case ExceptionMessageId.Esp2139:
                return(string.Format(MessageFormat.Esp2139, args));

            case ExceptionMessageId.Esp2140:
                return(string.Format(MessageFormat.Esp2140, args));

            case ExceptionMessageId.Esp2141:
                return(string.Format(MessageFormat.Esp2141, args));

            case ExceptionMessageId.Esp2142:
                return(string.Format(MessageFormat.Esp2142, args));

            case ExceptionMessageId.Esp2143:
                return(string.Format(MessageFormat.Esp2143, args));

            case ExceptionMessageId.Esp2228:
                return(string.Format(MessageFormat.Esp2228, args));

            case ExceptionMessageId.Esp2150:
                return(string.Format(MessageFormat.Esp2150, args));

            case ExceptionMessageId.Esp2151:
                return(string.Format(MessageFormat.Esp2151, args));

            case ExceptionMessageId.Esp2152:
                return(string.Format(MessageFormat.Esp2152, args));

                #endregion

                #region SqlBuildException
            case ExceptionMessageId.Esp2112:
                return(string.Format(MessageFormat.Esp2112, args));

            case ExceptionMessageId.Esp2115:
                return(string.Format(MessageFormat.Esp2115, args));

            case ExceptionMessageId.Esp2116:
                return(string.Format(MessageFormat.Esp2116, args));

            case ExceptionMessageId.Esp2117:
                return(string.Format(MessageFormat.Esp2117, args));

            case ExceptionMessageId.Esp2122:
                return(string.Format(MessageFormat.Esp2122, args));

            case ExceptionMessageId.Esp2123:
                return(string.Format(MessageFormat.Esp2123, args));

            case ExceptionMessageId.Esp2224:
                return(string.Format(MessageFormat.Esp2224, args));

                #endregion

            case ExceptionMessageId.Esp2201:
                return(string.Format(MessageFormat.Esp2201));

                #region ExpressionEvaluateException
            case ExceptionMessageId.EspA001:
                return(string.Format(MessageFormat.EspA001, args));

            case ExceptionMessageId.EspA002:
                return(string.Format(MessageFormat.EspA002, args));

            case ExceptionMessageId.EspA003:
                return(string.Format(MessageFormat.EspA003, args));

            case ExceptionMessageId.EspA011:
                return(string.Format(MessageFormat.EspA011, args));

            case ExceptionMessageId.EspA012:
                return(string.Format(MessageFormat.EspA012, args));

            case ExceptionMessageId.EspA013:
                return(string.Format(MessageFormat.EspA013, args));

            case ExceptionMessageId.EspA014:
                return(string.Format(MessageFormat.EspA014, args));

            case ExceptionMessageId.EspA021:
                return(string.Format(MessageFormat.EspA021, args));

            case ExceptionMessageId.EspA031:
                return(string.Format(MessageFormat.EspA031, args));

            case ExceptionMessageId.EspA032:
                return(string.Format(MessageFormat.EspA032, args));

            case ExceptionMessageId.EspA033:
                return(string.Format(MessageFormat.EspA033, args));

            case ExceptionMessageId.EspA034:
                return(string.Format(MessageFormat.EspA034, args));

            case ExceptionMessageId.EspA035:
                return(string.Format(MessageFormat.EspA035, args));

            case ExceptionMessageId.EspA036:
                return(string.Format(MessageFormat.EspA036, args));

            case ExceptionMessageId.EspA037:
                return(string.Format(MessageFormat.EspA037, args));

            case ExceptionMessageId.EspA038:
                return(string.Format(MessageFormat.EspA038, args));

            case ExceptionMessageId.EspA041:
                return(string.Format(MessageFormat.EspA041, args));

                #endregion

            case ExceptionMessageId.EspB001:
                return(string.Format(MessageFormat.EspB001, args));

            case ExceptionMessageId.EspC001:
                return(string.Format(MessageFormat.EspC001, args));

            case ExceptionMessageId.EspC002:
                return(string.Format(MessageFormat.EspC002, args));

            case ExceptionMessageId.EspD001:
                return(string.Format(MessageFormat.EspD001));

            case ExceptionMessageId.EspD002:
                return(string.Format(MessageFormat.EspD002));

            case ExceptionMessageId.EspD003:
                return(string.Format(MessageFormat.EspD003));

            case ExceptionMessageId.EspD004:
                return(string.Format(MessageFormat.EspD004));

            default:
                throw new InvalidOperationException($"Unknown message id:{messageId}");
            }
        }
Exemple #20
0
        public static string GetExceptionMessage(ExceptionMessageId message, params string[] replacements)
        {
            switch (message)
            {
            case ExceptionMessageId.ArgumentCannotBeEmpty:
                return(string.Format(Resources.AE_ArgumentCannotBeEmpty, replacements));

            case ExceptionMessageId.CannotTermBinaryOperation:
                return(string.Format(Resources.AE_CannotTermBinaryOperation, replacements));

            case ExceptionMessageId.CoercionDoesNotExist:
                return(string.Format(Resources.AE_CoercionDoesNotExist, replacements));

            case ExceptionMessageId.CompiledType_NotProperKind:
                return(string.Format(Resources.AE_CompiledType_NotProperKind, replacements));

            case ExceptionMessageId.ConditionMustBeBreakable:
                return(string.Format(Resources.AE_ConditionMustBeBreakable, replacements));

            case ExceptionMessageId.DataCannotBeEmpty:
                return(string.Format(Resources.AE_DataCannotBeEmpty, replacements));

            case ExceptionMessageId.DetachedExpressionNotValidFor:
                return(string.Format(Resources.AE_DetachedExpressionNotValidFor, replacements));

            case ExceptionMessageId.DuplicateKeyExists:
                return(string.Format(Resources.AE_DuplicateKeyExists, replacements));

            case ExceptionMessageId.ElementTypeMustBeGivenKind:
                return(string.Format(Resources.AE_ElementTypeMustBeGivenKind, replacements));

            case ExceptionMessageId.GenericClosureReplacementCount:
                return(string.Format(Resources.AE_GenericClosureReplacementCount, replacements));

            case ExceptionMessageId.GenericParameterRequiresName:
                return(string.Format(Resources.AE_GenericParameterRequiresName, replacements));

            case ExceptionMessageId.InsufficientSpaceForCopy:
                return(string.Format(Resources.AE_InsufficientSpaceForCopy, replacements));

            case ExceptionMessageId.InterfaceNotImplemented:
                return(string.Format(Resources.AE_InterfaceNotImplemented, replacements));

            case ExceptionMessageId.InvalidTCheckDerivation:
                return(string.Format(Resources.AE_InvalidTCheckDerivation, replacements));

            case ExceptionMessageId.JumpTargetMustBeLabel:
                return(string.Format(Resources.AE_JumpTargetMustBeLabel, replacements));

            case ExceptionMessageId.ManifestModuleTarget:
                return(string.Format(Resources.AE_ManifestModuleTarget, replacements));

            case ExceptionMessageId.MemberOfSeriesNull:
                return(string.Format(Resources.AE_MemberOfSeriesNull, replacements));

            case ExceptionMessageId.NamedGenericParameterExists:
                return(string.Format(Resources.AE_NamedGenericParameterExists, replacements));

            case ExceptionMessageId.NamespacePathAlreadyPresent:
                return(string.Format(Resources.AE_NamespacePathAlreadyPresent, replacements));

            case ExceptionMessageId.NonNullableTypeProvided:
                return(string.Format(Resources.AE_NonNullableTypeProvided, replacements));

            case ExceptionMessageId.NumericControllerMismatch:
                return(string.Format(Resources.AE_NumericControllerMismatch, replacements));

            case ExceptionMessageId.NumericValueParseError:
                return(string.Format(Resources.AE_NumericValueParseError, replacements));

            case ExceptionMessageId.OnlyNullableOnTerm:
                return(string.Format(Resources.AE_OnlyNullableOnTerm, replacements));

            case ExceptionMessageId.OperationMustBeTerm:
                return(string.Format(Resources.AE_OperationMustBeTerm, replacements));

            case ExceptionMessageId.ParentMustBeEqual:
                return(string.Format(Resources.AE_ParentMustBeEqual, replacements));

            case ExceptionMessageId.Part_CannotBeRoot:
                return(string.Format(Resources.AE_Part_CannotBeRoot, replacements));

            case ExceptionMessageId.Part_MustReferenceRoot:
                return(string.Format(Resources.AE_Part_MustReferenceRoot, replacements));

            case ExceptionMessageId.Part_RootOfASeparateSeries:
                return(string.Format(Resources.AE_Part_RootOfASeparateSeries, replacements));

            case ExceptionMessageId.PathCannotBeDotsOnly:
                return(string.Format(Resources.AE_PathCannotBeDotsOnly, replacements));

            case ExceptionMessageId.Primitive_Invalid:
                return(string.Format(Resources.AE_Primitive_Invalid, replacements));

            case ExceptionMessageId.Primitive_NonStringObject:
                return(string.Format(Resources.AE_Primitive_NonStringObject, replacements));

            case ExceptionMessageId.ProvidedExpressionCannotBe:
                return(string.Format(Resources.AE_ProvidedExpressionCannotBe, replacements));

            case ExceptionMessageId.RankMustBeOneOrGreater:
                return(string.Format(Resources.AE_RankMustBeOneOrGreater, replacements));

            case ExceptionMessageId.RelationalInvalidOnExpression:
                return(string.Format(Resources.AE_RelationalInvalidOnExpression, replacements));

            case ExceptionMessageId.Remove_ValueNotFound:
                return(string.Format(Resources.AE_Remove_ValueNotFound, replacements));

            case ExceptionMessageId.RemoveFailed_CustomAttributeNotFound:
                return(string.Format(Resources.AE_RemoveFailed_CustomAttributeNotFound, replacements));

            case ExceptionMessageId.SourceStringInvalid:
                return(string.Format(Resources.AE_SourceStringInvalid, replacements));

            case ExceptionMessageId.SubordinateCannotChange:
                return(string.Format(Resources.AE_SubordinateCannotChange, replacements));

            case ExceptionMessageId.SubordinateDoesNotExist:
                return(string.Format(Resources.AE_SubordinateDoesNotExist, replacements));

            case ExceptionMessageId.SubordinateInvalid:
                return(string.Format(Resources.AE_SubordinateInvalid, replacements));

            case ExceptionMessageId.SubordinateMismatch:
                return(string.Format(Resources.AE_SubordinateMismatch, replacements));

            case ExceptionMessageId.SubordinateNull:
                return(string.Format(Resources.AE_SubordinateNull, replacements));

            case ExceptionMessageId.SubordinateSubTypeDuplicate:
                return(string.Format(Resources.AE_SubordinateSubTypeDuplicate, replacements));

            case ExceptionMessageId.SourceStreamInvalidLength:
                return(string.Format(Resources.AE_SourceStreamInvalidLength, replacements));

            case ExceptionMessageId.TransitionKeyCollision:
                return(string.Format(Resources.AE_TransitionKeyCollision, replacements));

            case ExceptionMessageId.TypeAlreadyGenericClosure:
                return(string.Format(Resources.AE_TypeAlreadyGenericClosure, replacements));

            case ExceptionMessageId.TypedName_ImplicitConversion:
                return(string.Format(Resources.AE_TypedName_ImplicitConversion, replacements));

            case ExceptionMessageId.TypedName_Invalid:
                return(string.Format(Resources.AE_TypedName_Invalid, replacements));

            case ExceptionMessageId.TypedName_InvalidElement:
                return(string.Format(Resources.AE_TypedName_InvalidElement, replacements));

            case ExceptionMessageId.TypedName_ReferenceKind:
                return(string.Format(Resources.AE_TypedName_ReferenceKind, replacements));

            case ExceptionMessageId.TypeInvalidElementType:
                return(string.Format(Resources.AE_TypeInvalidElementType, replacements));

            case ExceptionMessageId.TypeMustNotBeAReferenceType:
                return(string.Format(Resources.AE_TypeMustNotBeAReferenceType, replacements));

            case ExceptionMessageId.TypeNotGeneric:
                return(string.Format(Resources.AE_TypeNotGeneric, replacements));

            case ExceptionMessageId.TypeNotGivenKind:
                return(string.Format(Resources.AE_TypeNotGivenKind, replacements));

            case ExceptionMessageId.TypeRelationalCheckRequiresType:
                return(string.Format(Resources.AE_TypeRelationalCheckRequiresType, replacements));

            case ExceptionMessageId.TypeRelationalTypeCannotBeNull:
                return(string.Format(Resources.AE_TypeRelationalTypeCannotBeNull, replacements));

            case ExceptionMessageId.TypeRelationalOrNullCastMustBeReference:
                return(string.Format(Resources.AE_TypeRelationalOrNullCastMustBeReference, replacements));

            case ExceptionMessageId.TypesAssemblyIsFixed:
                return(string.Format(Resources.AE_TypesAssemblyIsFixed, replacements));

            case ExceptionMessageId.UnknownArgument:
                return(string.Format(Resources.AE_UnknownArgument, replacements));

            case ExceptionMessageId.UnknownArgumentMessage:
                return(string.Format(Resources.AE_UnknownArgumentMessage, replacements));

            case ExceptionMessageId.UnknownArgumentWord:
                return(string.Format(Resources.AE_UnknownArgumentWord, replacements));

            case ExceptionMessageId.ValueIsWrongType:
                return(string.Format(Resources.AE_ValueIsWrongType, replacements));

            default:
                throw ObtainArgumentException(ArgumentWithException.message, ExceptionMessageId.UnknownArgumentMessage);
            }
        }