-
Notifications
You must be signed in to change notification settings - Fork 186
/
CsomServiceException.cs
47 lines (42 loc) · 1.54 KB
/
CsomServiceException.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
using System;
using System.Text.Json;
namespace PnP.Core
{
/// <summary>
/// CSOM Service exception
/// </summary>
public class CsomServiceException : ServiceException
{
#region Default exception constructors
internal CsomServiceException(string message) : base(message)
{
}
internal CsomServiceException(string message, Exception innerException) : base(message, innerException)
{
}
internal CsomServiceException()
{
}
#endregion
#region Custom constructors
/// <summary>
/// Creates a <see cref="CsomServiceException"/> using the provided error type, http response code and CSOM request response
/// </summary>
/// <param name="type">Type of the error</param>
/// <param name="httpResponseCode">Http response code of the executed CSOM request</param>
/// <param name="response">JSON response of the executed CSOM request</param>
public CsomServiceException(ErrorType type, int httpResponseCode, JsonElement response) : base("CSOM service exception")
{
Error = new CsomError(type, httpResponseCode, response);
}
#endregion
/// <summary>
/// Outputs a <see cref="CsomServiceException"/> to a string representation
/// </summary>
/// <returns>String representation</returns>
public override string ToString()
{
return $"{Error?.ToString()}{Environment.NewLine}{base.ToString()}";
}
}
}