forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThrowHelper.cs
More file actions
26 lines (22 loc) · 1.21 KB
/
ThrowHelper.cs
File metadata and controls
26 lines (22 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Npgsql.BackendMessages;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace Npgsql
{
static class ThrowHelper
{
[DoesNotReturn]
internal static void ThrowInvalidCastException_NoValue(FieldDescription field) =>
throw new InvalidCastException($"Column '{field.Name}' is null.");
[DoesNotReturn]
internal static void ThrowInvalidOperationException_NoPropertyGetter(Type type, MemberInfo property) =>
throw new InvalidOperationException($"Composite type '{type}' cannot be written because the '{property}' property has no getter.");
[DoesNotReturn]
internal static void ThrowInvalidOperationException_NoPropertySetter(Type type, MemberInfo property) =>
throw new InvalidOperationException($"Composite type '{type}' cannot be read because the '{property}' property has no setter.");
[DoesNotReturn]
internal static void ThrowInvalidOperationException_BinaryImportParametersMismatch(int columnCount, int valueCount) =>
throw new InvalidOperationException($"The binary import operation was started with {columnCount} column(s), but {valueCount} value(s) were provided.");
}
}