HttpContentException Class

Namespace
Kampute.HttpClient
Assembly
  • Kampute.HttpClient.dll

Definition

The exception that is thrown when the content of a response cannot be read into the requested type.
public class HttpContentException : Exception
Inheritance

Remarks

The content cannot be read when the response has no body, when no registered content formatter reads its media type into the requested type, or when the formatter fails; in the last case, the exception of the formatter is the inner exception.

Constructors

HttpContentException()

Initializes a new instance of the HttpContentException class.
public HttpContentException()

HttpContentException(string)

Initializes a new instance of the HttpContentException class with a specified error message.
public HttpContentException(string message)

Parameters

message string
The message that describes the error.

HttpContentException(string, Exception)

Initializes a new instance of the HttpContentException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public HttpContentException(string message, Exception innerException)

Parameters

message string
The error message that explains the reason for the exception.
innerException Exception
The exception that is the cause of the current exception, or a null reference if no inner exception is specified.

Properties

Content

Gets or sets the content that could not be read.
public HttpContent Content { get; set; }

Property Value

HttpContent
The content that could not be read, if any.

ObjectType

Gets or sets the type into which the content was to be read.
public Type ObjectType { get; set; }

Property Value

Type
The requested type, if any.

Methods

ToString()

Creates and returns a string representation of the current exception.
public override string ToString()

Returns

string
A string representation of the current exception.

Extension Methods

IsTransientNetworkError(this Exception)Determines whether an exception reports a network failure that a retry could overcome.