Aller au contenu principal

AxiosException Class

Axios.Net › AxiosNet.Errors

Thrown when a request fails: rejected status, timeout, cancellation, network error or bad configuration.

public class AxiosException : System.Exception

Inheritance System.Object → System.Exception → AxiosException

Derived
↳ CanceledError

Constructors​

AxiosException(string, string, AxiosRequestConfig, HttpRequestMessage, AxiosResponse, Exception) Constructor​

Creates the error of a failed request.

public AxiosException(string message, string code, AxiosNet.Config.AxiosRequestConfig config, System.Net.Http.HttpRequestMessage? request=null, AxiosNet.Models.AxiosResponse? response=null, System.Exception? inner=null);

Parameters​

message System.String

Description of the failure.

code System.String

One of AxiosErrorCodes.

config AxiosRequestConfig

The config the request was sent with.

request System.Net.Http.HttpRequestMessage

The request that was sent, when it got that far.

response AxiosResponse

The response, when the server answered.

inner System.Exception

The exception that caused this one.

Properties​

AxiosException.Code Property​

One of AxiosErrorCodes.

public string Code { get; }

Property Value​

System.String

AxiosException.Config Property​

The config the request was sent with.

public AxiosNet.Config.AxiosRequestConfig Config { get; }

Property Value​

AxiosRequestConfig

AxiosException.IsAxiosError Property​

Always true, like the isAxiosError flag of axios errors.

public bool IsAxiosError { get; }

Property Value​

System.Boolean

AxiosException.Request Property​

The request that was sent, when it got that far.

public System.Net.Http.HttpRequestMessage? Request { get; }

Property Value​

System.Net.Http.HttpRequestMessage

AxiosException.Response Property​

Set when the server answered; Data holds the (transformed) body text.

public AxiosNet.Models.AxiosResponse? Response { get; }

Property Value​

AxiosResponse

AxiosException.Status Property​

HTTP status of Response, when the server answered.

public System.Nullable<int> Status { get; }

Property Value​

System.Nullable<System.Int32>

Methods​

AxiosException.ToJSON() Method​

Serializable view of the error. Config keys listed in Redact are masked (case-insensitive, recursive).

public System.Collections.Generic.IDictionary<string,object?> ToJSON();

Returns​

System.Collections.Generic.IDictionary<System.String,System.Object>