28 lines
No EOL
740 B
C#
28 lines
No EOL
740 B
C#
using System.Net;
|
|
using System.Text.Json.Nodes;
|
|
using Foxcord.Serialization;
|
|
|
|
namespace Foxcord.Rest;
|
|
|
|
public class RestException : Exception
|
|
{
|
|
public HttpStatusCode StatusCode { get; private init; }
|
|
public int Code { get; private init; }
|
|
public new string Message { get; private init; }
|
|
public string? Errors { get; private init; }
|
|
|
|
internal RestException(HttpStatusCode statusCode, ErrorResponse response)
|
|
{
|
|
StatusCode = statusCode;
|
|
Code = response.Code;
|
|
Message = response.Message;
|
|
Errors = response.Errors?.ToJsonString();
|
|
}
|
|
|
|
public enum ErrorCode
|
|
{
|
|
GeneralError = 0
|
|
}
|
|
|
|
internal record ErrorResponse(int Code, string Message, JsonObject? Errors);
|
|
} |