Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DataSetUtil.cs
Go to the documentation of this file.
1using System;
2using System.Data;
6
7internal static class DataSetUtil
8{
9 private static readonly Type s_stackOverflowType = typeof(StackOverflowException);
10
11 private static readonly Type s_outOfMemoryType = typeof(OutOfMemoryException);
12
13 private static readonly Type s_threadAbortType = typeof(ThreadAbortException);
14
15 private static readonly Type s_nullReferenceType = typeof(NullReferenceException);
16
17 private static readonly Type s_accessViolationType = typeof(AccessViolationException);
18
19 private static readonly Type s_securityType = typeof(SecurityException);
20
21 internal static void CheckArgumentNull<T>(T argumentValue, string argumentName) where T : class
22 {
23 if (argumentValue == null)
24 {
25 throw ArgumentNull(argumentName);
26 }
27 }
28
29 private static T TraceException<T>(string trace, T e)
30 {
31 return e;
32 }
33
34 private static T TraceExceptionAsReturnValue<T>(T e)
35 {
36 return TraceException("<comm.ADP.TraceException|ERR|THROW> '%ls'\n", e);
37 }
38
39 internal static ArgumentException Argument(string message)
40 {
41 return TraceExceptionAsReturnValue(new ArgumentException(message));
42 }
43
44 internal static ArgumentNullException ArgumentNull(string message)
45 {
46 return TraceExceptionAsReturnValue(new ArgumentNullException(message));
47 }
48
49 internal static ArgumentOutOfRangeException ArgumentOutOfRange(string message, string parameterName)
50 {
51 return TraceExceptionAsReturnValue(new ArgumentOutOfRangeException(parameterName, message));
52 }
53
54 internal static InvalidCastException InvalidCast(string message)
55 {
56 return TraceExceptionAsReturnValue(new InvalidCastException(message));
57 }
58
59 internal static InvalidOperationException InvalidOperation(string message)
60 {
61 return TraceExceptionAsReturnValue(new InvalidOperationException(message));
62 }
63
64 internal static NotSupportedException NotSupported(string message)
65 {
66 return TraceExceptionAsReturnValue(new NotSupportedException(message));
67 }
68
73
78
83
84 internal static bool IsCatchableExceptionType(Exception e)
85 {
86 Type type = e.GetType();
88 {
89 return !s_securityType.IsAssignableFrom(type);
90 }
91 return false;
92 }
93}
static NotSupportedException NotSupported(string message)
static ArgumentOutOfRangeException InvalidDataRowState(DataRowState value)
static InvalidCastException InvalidCast(string message)
static readonly Type s_nullReferenceType
static InvalidOperationException InvalidOperation(string message)
static readonly Type s_threadAbortType
static ArgumentException Argument(string message)
static ArgumentOutOfRangeException InvalidEnumerationValue(Type type, int value)
static ArgumentOutOfRangeException ArgumentOutOfRange(string message, string parameterName)
static ArgumentNullException ArgumentNull(string message)
static ArgumentOutOfRangeException InvalidLoadOption(LoadOption value)
static readonly Type s_accessViolationType
static readonly Type s_stackOverflowType
Definition DataSetUtil.cs:9
static T TraceExceptionAsReturnValue< T >(T e)
static readonly Type s_securityType
static void CheckArgumentNull< T >(T argumentValue, string argumentName)
static readonly Type s_outOfMemoryType
static bool IsCatchableExceptionType(Exception e)
static T TraceException< T >(string trace, T e)
new Type GetType()
Definition Exception.cs:437
static CultureInfo InvariantCulture
static string DataSetLinq_InvalidEnumerationValue
Definition SR.cs:918
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7