Table of Contents

Class CurlHttpException

Namespace
CurlDotNet.Core
Assembly
CurlDotNet.dll

Exception for HTTP errors (4xx, 5xx status codes).

Thrown by EnsureSuccess() when request fails:

try
{
    result.EnsureSuccess();
}
catch (CurlHttpException ex)
{
    Console.WriteLine($"HTTP {ex.StatusCode}: {ex.Message}");
    Console.WriteLine($"Response was: {ex.ResponseBody}");
}
public class CurlHttpException : Exception, ISerializable
Inheritance
CurlHttpException
Implements
Inherited Members

Constructors

CurlHttpException(string, int)

public CurlHttpException(string message, int statusCode)

Parameters

message string
statusCode int

Properties

ResponseBody

The response body (may contain error details)

public string ResponseBody { get; set; }

Property Value

string

ResponseHeaders

The response headers

public Dictionary<string, string> ResponseHeaders { get; set; }

Property Value

Dictionary<string, string>

StatusCode

The HTTP status code that caused the error

public int StatusCode { get; }

Property Value

int