forked from anthonyreilly/NetCoreForce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForceAPIException.cs
51 lines (43 loc) · 1.58 KB
/
ForceAPIException.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
using System;
using System.Collections.Generic;
using System.Net;
using NetCoreForce.Client.Models;
namespace NetCoreForce.Client
{
public class ForceApiException : Exception
{
public List<ErrorResponse> Errors { get; set; }
// public string[] Fields { get; private set; }
// public string ErrorCode { get; private set; }
public HttpStatusCode HttpStatusCode { get; private set; }
public ForceApiException(string message)
: this(message, new List<ErrorResponse>(), new HttpStatusCode())
{
}
public ForceApiException(string message, List<ErrorResponse> errors)
: this(message, errors, new HttpStatusCode())
{
}
public ForceApiException(string message, ErrorResponse error, HttpStatusCode httpStatusCode)
: this(message, new List<ErrorResponse>() { error }, new HttpStatusCode())
{
}
public ForceApiException(string message, List<ErrorResponse> errors, HttpStatusCode httpStatusCode)
: base(message)
{
Errors = errors;
HttpStatusCode = httpStatusCode;
}
// public ForceApiException(List<ErrorResponse> errors, HttpStatusCode httpStatusCode)
// : base()
// {
// Errors = errors;
// HttpStatusCode = httpStatusCode;
// }
// private static Error ParseError(string error)
// {
// Error value;
// return Enum.TryParse(error.Replace("_", ""), true, out value) ? value : Error.Unknown;
// }
}
}