Table of Contents

Class HttpException

Namespace
Discord.Net
Assembly
Discord.Net.Core.dll

The exception that is thrown if an error occurs while processing an Discord HTTP request.

public class HttpException : Exception, ISerializable
Inheritance
HttpException
Implements
Derived
Inherited Members

Constructors

HttpException(HttpStatusCode, IRequest, DiscordErrorCode?, string, DiscordJsonError[])

Initializes a new instance of the HttpException class.

public HttpException(HttpStatusCode httpCode, IRequest request, DiscordErrorCode? discordCode = null, string reason = null, DiscordJsonError[] errors = null)

Parameters

httpCode HttpStatusCode

The HTTP status code returned.

request IRequest

The request that was sent prior to the exception.

discordCode DiscordErrorCode?

The Discord status code returned.

reason string

The reason behind the exception.

errors DiscordJsonError[]

Properties

DiscordCode

Gets the JSON error code returned by Discord.

public DiscordErrorCode? DiscordCode { get; }

Property Value

DiscordErrorCode?

A JSON error code from Discord, or null if none.

Errors

Gets a collection of json errors describing what went wrong with the request.

public IReadOnlyCollection<DiscordJsonError> Errors { get; }

Property Value

IReadOnlyCollection<DiscordJsonError>

HttpCode

Gets the HTTP status code returned by Discord.

public HttpStatusCode HttpCode { get; }

Property Value

HttpStatusCode

An HTTP status code from Discord.

Reason

Gets the reason of the exception.

public string Reason { get; }

Property Value

string

Request

Gets the request object used to send the request.

public IRequest Request { get; }

Property Value

IRequest