Show / Hide Table of Contents

# Class HttpException

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

##### Inheritance

System.Object
System.Exception
HttpException

##### Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception

##### Inherited Members

System.Exception.GetBaseException()
System.Exception.ToString()
System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
System.Exception.GetType()
System.Exception.Message
System.Exception.Data
System.Exception.InnerException
System.Exception.TargetSite
System.Exception.StackTrace
System.Exception.HelpLink
System.Exception.Source
System.Exception.HResult
System.Exception.SerializeObjectState
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.MemberwiseClone()

###### Namespace: Discord.Net

###### Assembly: Discord.Net.Core.dll

##### Syntax

    public class HttpException : Exception, ISerializable, _Exception

### Constructors

| Improve this Doc View Source

#### HttpException(HttpStatusCode, IRequest, Nullable<Int32>, String)

Initializes a new instance of the HttpException class.

##### Declaration

    public HttpException(HttpStatusCode httpCode, IRequest request, int? discordCode = default(int? ), string reason = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Net.HttpStatusCode | httpCode | The HTTP status code returned.
IRequest | request | The request that was sent prior to the exception.
System.Nullable<System.Int32> | discordCode | The Discord status code returned.
System.String | reason | The reason behind the exception.

### Properties

| Improve this Doc View Source

#### DiscordCode

Gets the JSON error code returned by Discord.

##### Declaration

    public int? DiscordCode { get; }

##### Property Value

Type | Description
--- | ---
System.Nullable<System.Int32> | A JSON error code from Discord, or `null` if none.

| Improve this Doc View Source

#### HttpCode

Gets the HTTP status code returned by Discord.

##### Declaration

    public HttpStatusCode HttpCode { get; }

##### Property Value

Type | Description
--- | ---
System.Net.HttpStatusCode | An HTTP status code from Discord.

| Improve this Doc View Source

#### Reason

Gets the reason of the exception.

##### Declaration

    public string Reason { get; }

##### Property Value

Type | Description
--- | ---
System.String |

| Improve this Doc View Source

#### Request

Gets the request object used to send the request.

##### Declaration

    public IRequest Request { get; }

##### Property Value

Type | Description
--- | ---
IRequest |

### Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception