-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathError.cs
More file actions
29 lines (25 loc) · 928 Bytes
/
Error.cs
File metadata and controls
29 lines (25 loc) · 928 Bytes
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
using System.Net;
namespace Utility.BaseClasses
{
/// <summary>
/// A class that allows you to store and return an HttpStatusCode and a string message. This is very useful when returning responses from API requests where you need to return the status code and a message about why the status code was returned.
/// </summary>
public class Error
{
public HttpStatusCode Status { get; set; }
public string Message { get; set; }
public Error() : base()
{
Status = HttpStatusCode.NoContent;
Message = string.Empty;
}
public Error(bool initializeMessage = false) : base()
{
Status = HttpStatusCode.NoContent;
if (initializeMessage)
Message = "Initialized: Must set HttpStatusCode.Ok when ready to return data!";
else
Message = string.Empty;
}
}
}