-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathApiException.mustache
73 lines (65 loc) · 2.48 KB
/
ApiException.mustache
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
{{>partial_header}}
using System;
{{#useCustomTemplateCode}}
using Dropbox.Sign.Model;
{{/useCustomTemplateCode}}
namespace {{packageName}}.Client
{
/// <summary>
/// API Exception
/// </summary>
{{>visibility}} class ApiException : Exception
{
/// <summary>
/// Gets or sets the error code (HTTP status code)
/// </summary>
/// <value>The error code (HTTP status code).</value>
public int ErrorCode { get; set; }
/// <summary>
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
{{^useCustomTemplateCode}}
public object ErrorContent { get; private set; }
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
public ErrorResponse ErrorContent { get; private set; }
{{/useCustomTemplateCode}}
/// <summary>
/// Gets or sets the HTTP headers
/// </summary>
/// <value>HTTP headers</value>
public Multimap<string, string> Headers { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
public ApiException() { }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
public ApiException(int errorCode, string message) : base(message)
{
this.ErrorCode = errorCode;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
/// <param name="headers">HTTP Headers.</param>
{{^useCustomTemplateCode}}
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
public ApiException(int errorCode, string message, ErrorResponse errorContent = null, Multimap<string, string> headers = null) : base(message)
{{/useCustomTemplateCode}}
{
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
this.Headers = headers;
}
}
}