-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathContentStackError.cs
More file actions
94 lines (82 loc) · 2.66 KB
/
ContentStackError.cs
File metadata and controls
94 lines (82 loc) · 2.66 KB
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
using System;
using System.Collections.Generic;
using System.Net;
using System.Text.Json.Serialization;
namespace Contentstack.Core.Internals
{
/// <summary>
/// The ContentstackError class is abstraction of general exception class.
/// </summary>
public class ContentstackException : Exception
{
#region Private Variables
private string _ErrorMessage = string.Empty;
#endregion
#region Public Variables
/// <summary>
/// This is http response status code of REST request to Contentstack.
/// </summary>
public HttpStatusCode StatusCode;
/// <summary>
/// This is error message.
/// </summary>
public new string Message;
/// <summary>
/// This is type of response.
/// </summary>
public ResponseType ResponseType = ResponseType.Network;
/// <summary>
/// This is error message.
/// </summary>
[JsonPropertyName("error_message")]
public string ErrorMessage
{
get
{
return this._ErrorMessage;
}
set
{
this._ErrorMessage = value;
this.Message = value;
}
}
/// <summary>
/// This is error code.
/// </summary>
[JsonPropertyName("error_code")]
public int ErrorCode { get; set; }
/// <summary>
/// Set of errors in detail.
/// </summary>
[JsonPropertyName("errors")]
public Dictionary<string, object> Errors { get; set; }
#endregion
#region Public Constructors
/// <summary>
/// The ContentstackError class is abstraction of general exception class.
/// </summary>
public ContentstackException()
{
}
/// <summary>
/// The ContentstackError class is abstraction of general exception class.
/// </summary>
/// <param name="errorMessage"> Error Message</param>
public ContentstackException(string errorMessage)
: base(errorMessage)
{
this.ErrorMessage = errorMessage;
}
/// <summary>
/// The ContentstackError class is abstraction of general exception class.
/// </summary>
/// <param name="exception"> Exception</param>
public ContentstackException(Exception exception)
: base(exception.Message, exception.InnerException)
{
this.ErrorMessage = exception.Message;
}
#endregion
}
}