Class HttpException
The exception that is thrown if an error occurs while processing an Discord HTTP request.
Namespace: Discord.Net
Assembly: Discord.Net.Core.dll
Syntax
public class HttpException : Exception
Constructors
| Improve this Doc View SourceHttpException(HttpStatusCode, IRequest, Nullable<DiscordErrorCode>, String, DiscordJsonError[])
Initializes a new instance of the HttpException class.
Declaration
public HttpException(HttpStatusCode httpCode, IRequest request, DiscordErrorCode? discordCode = null, string reason = null, DiscordJsonError[] errors = null)
Parameters
Type | Name | Description |
---|---|---|
HttpStatusCode | httpCode | The HTTP status code returned. |
IRequest | request | The request that was sent prior to the exception. |
Nullable<DiscordErrorCode> | discordCode | The Discord status code returned. |
String | reason | The reason behind the exception. |
DiscordJsonError[] | errors |
Properties
| Improve this Doc View SourceDiscordCode
Gets the JSON error code returned by Discord.
Declaration
public DiscordErrorCode? DiscordCode { get; }
Property Value
Type | Description |
---|---|
Nullable<DiscordErrorCode> | A
JSON error code
from Discord, or |
Errors
Gets a collection of json errors describing what went wrong with the request.
Declaration
public IReadOnlyCollection<DiscordJsonError> Errors { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<DiscordJsonError> |
HttpCode
Gets the HTTP status code returned by Discord.
Declaration
public HttpStatusCode HttpCode { get; }
Property Value
Type | Description |
---|---|
HttpStatusCode | An HTTP status code from Discord. |
Reason
Gets the reason of the exception.
Declaration
public string Reason { get; }
Property Value
Type | Description |
---|---|
String |
Request
Gets the request object used to send the request.
Declaration
public IRequest Request { get; }
Property Value
Type | Description |
---|---|
IRequest |