-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathRestException.cs
More file actions
31 lines (27 loc) · 1.03 KB
/
Copy pathRestException.cs
File metadata and controls
31 lines (27 loc) · 1.03 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
using System.Net;
namespace BytecodeApi.Rest;
/// <summary>
/// Represents an error that was raised by a REST API.
/// </summary>
public sealed class RestException : Exception
{
/// <summary>
/// Gets the response status code that is associated with this <see cref="RestException" />.
/// </summary>
public HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets the HTTP body that is associated with this <see cref="RestException" />.
/// </summary>
public string Content { get; }
/// <summary>
/// Initializes a new instance of the <see cref="RestException" /> class.
/// </summary>
/// <param name="statusCode">The error code that is associated with this <see cref="RestException" />.</param>
/// <param name="content">The HTTP body that is associated with this <see cref="RestException" />.</param>
public RestException(HttpStatusCode statusCode, string content) : base("The REST response was not successful.")
{
Check.ArgumentNull(content);
StatusCode = statusCode;
Content = content;
}
}