forked from smiley22/S22.Xmpp
-
Notifications
You must be signed in to change notification settings - Fork 51
/
XmppErrorException.cs
83 lines (78 loc) · 3.33 KB
/
XmppErrorException.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
using System;
using System.Runtime.Serialization;
namespace Sharp.Xmpp
{
/// <summary>
/// The exception that is thrown when a recoverable XMPP error condition
/// has been encountered.
/// </summary>
[Serializable()]
public class XmppErrorException : Exception
{
/// <summary>
/// The XMPP error.
/// </summary>
public XmppError Error
{
get;
private set;
}
/// <summary>
/// Initializes a new instance of the XmppErrorException class
/// </summary>
/// <param name="error">The XMPP error that is the reason for the exception.</param>
/// <exception cref="ArgumentNullException">The error parameter is null.</exception>
public XmppErrorException(XmppError error)
: base()
{
error.ThrowIfNull("error");
Error = error;
}
/// <summary>
/// Initializes a new instance of the XmppErrorException class with its message
/// string set to <paramref name="message"/>.
/// </summary>
/// <param name="error">The XMPP error that is the reason for the exception.</param>
/// <param name="message">A description of the error. The content of message is intended
/// to be understood by humans.</param>
/// <exception cref="ArgumentNullException">The error parameter is null.</exception>
public XmppErrorException(XmppError error, string message)
: base(message)
{
error.ThrowIfNull("error");
Error = error;
}
/// <summary>
/// Initializes a new instance of the XmppErrorException class with its message
/// string set to <paramref name="message"/> and a reference to the inner exception that
/// is the cause of this exception.
/// </summary>
/// <param name="error">The XMPP error that is the reason for the exception.</param>
/// <param name="message">A description of the error. The content of message is intended
/// to be understood by humans.</param>
/// <param name="inner">The exception that is the cause of the current exception.</param>
/// <exception cref="ArgumentNullException">The error parameter is null.</exception>
public XmppErrorException(XmppError error, string message, Exception inner)
: base(message, inner)
{
error.ThrowIfNull("error");
Error = error;
}
/// <summary>
/// Initializes a new instance of the XmppErrorException class with the specified
/// serialization and context information.
/// </summary>
/// <param name="error">The XMPP error that is the reason for the exception.</param>
/// <param name="info">An object that holds the serialized object data about the exception
/// being thrown. </param>
/// <param name="context">An object that contains contextual information about the source
/// or destination. </param>
/// <exception cref="ArgumentNullException">The error parameter is null.</exception>
protected XmppErrorException(XmppError error, SerializationInfo info, StreamingContext context)
: base(info, context)
{
error.ThrowIfNull("error");
Error = error;
}
}
}