-
Notifications
You must be signed in to change notification settings - Fork 186
/
AuthenticationException.cs
56 lines (50 loc) · 1.76 KB
/
AuthenticationException.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
using System;
namespace PnP.Core
{
/// <summary>
/// Authentication exception
/// </summary>
public class AuthenticationException : PnPException
{
#region Default exception constructors
internal AuthenticationException()
{
}
internal AuthenticationException(string message) : base(message)
{
}
internal AuthenticationException(string message, Exception innerException) : base(message, innerException)
{
}
#endregion
#region Custom constructors
/// <summary>
/// <see cref="AuthenticationException"/> constructor
/// </summary>
/// <param name="type">Type of error</param>
/// <param name="message">Error message</param>
public AuthenticationException(ErrorType type, string message) : base(message)
{
Error = new AuthenticationError(type, message);
}
/// <summary>
/// <see cref="AuthenticationException"/> constructor
/// </summary>
/// <param name="type">Type of error</param>
/// <param name="message">Error message</param>
/// <param name="innerException">Inner exception (if any)</param>
public AuthenticationException(ErrorType type, string message, Exception innerException) : base(message, innerException)
{
Error = new AuthenticationError(type, message);
}
#endregion
/// <summary>
/// Outputs a <see cref="AuthenticationException"/> to a string representation
/// </summary>
/// <returns>String representation</returns>
public override string ToString()
{
return $"{Error?.ToString()}{Environment.NewLine}{base.ToString()}";
}
}
}