/
DirectoryException.cs
104 lines (86 loc) · 3.97 KB
/
DirectoryException.cs
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Text;
namespace System.DirectoryServices.Protocols
{
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class DirectoryException : Exception
{
#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
protected DirectoryException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
public DirectoryException(string message, Exception inner) : base(message, inner)
{
}
public DirectoryException(string message) : base(message)
{
}
public DirectoryException() : base()
{
}
}
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class DirectoryOperationException : DirectoryException, ISerializable
{
#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
protected DirectoryOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
public DirectoryOperationException() : base(SR.DefaultOperationsError) { }
public DirectoryOperationException(string message) : base(message ?? SR.DefaultOperationsError) { }
public DirectoryOperationException(string message, Exception inner) : base(message ?? SR.DefaultOperationsError, inner) { }
public DirectoryOperationException(DirectoryResponse response) :
base(CreateMessage(response, message: null))
{
Response = response;
}
public DirectoryOperationException(DirectoryResponse response, string message)
: base(CreateMessage(response, message))
{
Response = response;
}
public DirectoryOperationException(DirectoryResponse response, string message, Exception inner)
: base(CreateMessage(response, message), inner)
{
Response = response;
}
public DirectoryResponse Response { get; internal set; }
private static string CreateMessage(DirectoryResponse response, string? message)
{
string result = message ?? SR.DefaultOperationsError;
if (!string.IsNullOrEmpty(response?.ErrorMessage))
{
result += " " + response.ErrorMessage;
}
return result;
}
}
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class BerConversionException : DirectoryException
{
#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context) { }
public BerConversionException() : base(SR.BerConversionError)
{
}
public BerConversionException(string message) : base(message ?? SR.BerConversionError)
{
}
public BerConversionException(string message, Exception inner) : base(message ?? SR.BerConversionError, inner)
{
}
}
}