Beispiel #1
0
        /// <summary>
        /// 返回参数异常。
        /// </summary>
        /// <param name="resName">异常信息的资源名称。</param>
        /// <param name="innerException">内部异常引用。</param>
        /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
        private static ArgumentException GetArgumentException(string resName,
                                                              Exception innerException)
        {
            string message = ExceptionResources.GetString(resName);

            return(new ArgumentException(message, innerException));
        }
Beispiel #2
0
        /// <summary>
        /// 返回缓冲池选项无效的异常。
        /// </summary>
        /// <param name="element">无效的缓冲池配置元素。</param>
        /// <returns><see cref="System.Configuration.ConfigurationErrorsException"/> 对象。</returns>
        internal static ConfigurationErrorsException InvalidCacheOptions(CacheElement element)
        {
            string message = ExceptionResources.GetString("InvalidCacheOptions", element.CacheType);

            return(new ConfigurationErrorsException(message,
                                                    element.ElementInformation.Source, element.ElementInformation.LineNumber));
        }
 /// <summary>
 /// 返回资源访问对象。
 /// </summary>
 private static ExceptionResources GetLoader()
 {
     if (resLoader == null)
     {
         lock (SyncObject)
         {
             if (resLoader == null)
             {
                 resLoader = new ExceptionResources();
             }
         }
     }
     return(resLoader);
 }
Beispiel #4
0
        /// <summary>
        /// 返回参数超出范围的异常。
        /// </summary>
        /// <param name="paramName">超出范围的参数名称。</param>
        /// <param name="begin">参数有效范围的起始值。</param>
        /// <param name="end">参数有效范围的结束值。</param>
        /// <returns><see cref="System.ArgumentOutOfRangeException"/> 对象。</returns>
        public static ArgumentOutOfRangeException ArgumentOutOfRange(string paramName, object begin, object end)
        {
            string message = ExceptionResources.GetString("ArgumentOutOfRangeBetween", paramName, begin, end);

            return(new ArgumentOutOfRangeException(paramName, message));
        }
Beispiel #5
0
        /// <summary>
        /// 返回参数异常。
        /// </summary>
        /// <param name="resName">异常信息的资源名称。</param>
        /// <param name="args">格式化信息的参数。</param>
        /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
        private static ArgumentException GetArgumentException(string resName, params object[] args)
        {
            string message = ExceptionResources.GetString(resName, args);

            return(new ArgumentException(message));
        }
Beispiel #6
0
        /// <summary>
        /// 返回参数超出范围的异常。
        /// </summary>
        /// <param name="paramName">超出范围的参数名称。</param>
        /// <returns><see cref="System.ArgumentOutOfRangeException"/> 对象。</returns>
        public static ArgumentOutOfRangeException ArgumentOutOfRange(string paramName)
        {
            string message = ExceptionResources.GetString("ArgumentOutOfRange", paramName);

            return(new ArgumentOutOfRangeException(paramName, message));
        }
Beispiel #7
0
 /// <summary>
 /// 返回数组类型与集合项类型不兼容的异常。
 /// </summary>
 /// <param name="innerException">内部异常引用。</param>
 /// <returns><see cref="System.ArrayTypeMismatchException"/> 对象。</returns>
 public static ArrayTypeMismatchException ArrayTypeInvalid(Exception innerException)
 {
     return(new ArrayTypeMismatchException(ExceptionResources.GetString("ArrayTypeInvalid"), innerException));
 }
Beispiel #8
0
 /// <summary>
 /// 返回未识别的词法单元的异常。
 /// </summary>
 /// <param name="text">未被识别的词法单元的文本。</param>
 /// <param name="start">词法单元的起始位置。</param>
 /// <param name="end">词法单元的结束位置。</param>
 /// <returns><see cref="Cyjb.IO.SourceException"/> 对象。</returns>
 public static SourceException UnrecognizedToken(string text, SourceLocation start, SourceLocation end)
 {
     return(new SourceException(ExceptionResources.GetString("UnrecognizedToken", text), start, end));
 }
Beispiel #9
0
 /// <summary>
 /// 返回不支持的异常。
 /// </summary>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <returns><see cref="System.NotSupportedException"/> 对象。</returns>
 private static NotSupportedException GetNotSupported(string resName)
 {
     return(new NotSupportedException(ExceptionResources.GetString(resName)));
 }
Beispiel #10
0
        /// <summary>
        /// 返回以特定名称字符串资源为信息的
        /// <see cref="System.OverflowException"/> 对象。
        /// </summary>
        /// <param name="resName">作为异常信息的字符串资源名称。</param>
        /// <returns><see cref="System.OverflowException"/> 对象。</returns>
        private static OverflowException GetOverflowException(string resName)
        {
            string message = ExceptionResources.GetString(resName);

            return(new OverflowException(message));
        }
Beispiel #11
0
 /// <summary>
 /// 返回异常集合反序列化失败的异常。
 /// </summary>
 /// <returns><see cref="System.Runtime.Serialization.SerializationException"/> 对象。</returns>
 public static SerializationException AggregateExceptionDeserializationFailure()
 {
     return(new SerializationException(
                ExceptionResources.GetString("AggregateExceptionDeserializationFailure")));
 }
Beispiel #12
0
 /// <summary>
 /// 返回偏移量和长度超出界限的异常。
 /// </summary>
 /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
 public static ArgumentException InvalidOffsetLength()
 {
     return(new ArgumentException(ExceptionResources.GetString("InvalidOffsetLength")));
 }
Beispiel #13
0
 /// <summary>
 /// 返回 SourceReader 已关闭的异常。
 /// </summary>
 /// <returns><see cref="System.ObjectDisposedException"/> 对象。</returns>
 internal static ObjectDisposedException SourceReaderClosed()
 {
     return(new ObjectDisposedException(ExceptionResources.GetString("SourceReaderClosed")));
 }
Beispiel #14
0
 /// <summary>
 /// 返回多维数组不被支持的异常。
 /// </summary>
 /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
 public static RankException ArrayRankMultiDimNotSupported()
 {
     return(new RankException(ExceptionResources.GetString("ArrayRankMultiDimNotSupported")));
 }
Beispiel #15
0
 /// <summary>
 /// 返回键不存在的异常。
 /// </summary>
 /// <param name="key">不存在的键。</param>
 /// <returns><see cref="System.Collections.Generic.KeyNotFoundException"/> 对象。</returns>
 public static KeyNotFoundException KeyNotFound(object key)
 {
     return(new KeyNotFoundException(ExceptionResources.GetString("KeyNotFound", key)));
 }
Beispiel #16
0
 /// <summary>
 /// 返回操作无效的异常。
 /// </summary>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <param name="args">异常信息的格式化值。</param>
 /// <returns><see cref="System.InvalidOperationException"/> 对象。</returns>
 private static InvalidOperationException GetInvalidOperation(string resName, params object[] args)
 {
     return(new InvalidOperationException(ExceptionResources.GetString(resName, args)));
 }
Beispiel #17
0
        /// <summary>
        /// 返回转换无效的异常。
        /// </summary>
        /// <param name="value">无效的值。</param>
        /// <param name="type">要转换到的类型。</param>
        /// <param name="innerException">内部异常。</param>
        /// <returns><see cref="System.InvalidCastException"/> 对象。</returns>
        public static InvalidCastException ConvertInvalidValue(object value, Type type, Exception innerException)
        {
            string message = ExceptionResources.GetString("ConvertInvalidValue", value, type);

            return(new InvalidCastException(message, innerException));
        }
Beispiel #18
0
        /// <summary>
        /// 返回以特定名称字符串资源为信息的
        /// <see cref="System.FormatException"/> 对象。
        /// </summary>
        /// <param name="resName">作为异常信息的字符串资源名称。</param>
        /// <returns><see cref="System.FormatException"/> 对象。</returns>
        private static FormatException GetFormatException(string resName)
        {
            string message = ExceptionResources.GetString(resName);

            return(new FormatException(message));
        }
Beispiel #19
0
 /// <summary>
 /// 返回资源访问对象。
 /// </summary>
 private static ExceptionResources GetLoader()
 {
     if (resLoader == null)
     {
         lock (SyncObject)
         {
             if (resLoader == null)
             {
                 resLoader = new ExceptionResources();
             }
         }
     }
     return resLoader;
 }
Beispiel #20
0
 /// <summary>
 /// 返回状态无效的异常。
 /// </summary>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <returns><see cref="System.InvalidOperationException"/> 对象。</returns>
 private static InvalidOperationException GetInvalidOperation(string resName)
 {
     return(new InvalidOperationException(ExceptionResources.GetString(resName)));
 }
Beispiel #21
0
 /// <summary>
 /// 返回找到多个与绑定约束匹配的属性的异常。
 /// </summary>
 /// <returns><see cref="System.Reflection.AmbiguousMatchException"/> 对象。</returns>
 internal static AmbiguousMatchException AmbiguousMatchProperty()
 {
     return(new AmbiguousMatchException(ExceptionResources.GetString("AmbiguousMatchProperty")));
 }
Beispiel #22
0
 /// <summary>
 /// 返回对象已释放资源的异常。
 /// </summary>
 /// <returns><see cref="System.ObjectDisposedException"/> 对象。</returns>
 public static ObjectDisposedException ObjectDisposed()
 {
     return(new ObjectDisposedException(ExceptionResources.GetString("ObjectDisposed")));
 }
Beispiel #23
0
 /// <summary>
 /// 返回参数异常。
 /// </summary>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <returns><see cref="System.ArgumentException"/> 对象。</returns>
 private static ArgumentException GetArgumentException(string resName)
 {
     return(new ArgumentException(ExceptionResources.GetString(resName)));
 }
Beispiel #24
0
 /// <summary>
 /// 返回找到多个与绑定约束匹配的方法的异常。
 /// </summary>
 /// <returns><see cref="System.Reflection.AmbiguousMatchException"/> 对象。</returns>
 internal static AmbiguousMatchException AmbiguousMatchMethod()
 {
     return(new AmbiguousMatchException(ExceptionResources.GetString("AmbiguousMatchMethod")));
 }
Beispiel #25
0
 /// <summary>
 /// 返回参数超出范围的异常。
 /// </summary>
 /// <param name="paramName">发生异常的参数名称。</param>
 /// <param name="resName">异常信息的资源名称。</param>
 /// <param name="args">异常信息的格式化对象。</param>
 /// <returns><see cref="System.ArgumentOutOfRangeException"/> 对象。</returns>
 private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(string paramName,
                                                                           string resName, params object[] args)
 {
     return(new ArgumentOutOfRangeException(paramName, ExceptionResources.GetString(resName, args)));
 }