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
Properties
ResponseBody
The response body (may contain error details)
public string ResponseBody { get; set; }
Property Value
ResponseHeaders
The response headers
public Dictionary<string, string> ResponseHeaders { get; set; }
Property Value
StatusCode
The HTTP status code that caused the error
public int StatusCode { get; }