CurlDotNet
CurlDotNet.Exceptions
CurlTimeoutException Class
Thrown when an operation exceeds the configured timeout period.
public class CurlTimeoutException : CurlDotNet.Exceptions.CurlException
Inheritance System.Object 🡒 System.Exception 🡒 CurlException 🡒 CurlTimeoutException
Derived
↳ CurlFtpAcceptTimeoutException
↳ CurlOperationTimeoutException
Example
try
{
// Set a 5 second timeout
var result = await curl.ExecuteAsync("curl --max-time 5 https://slow-server.com/large-file");
}
catch (CurlTimeoutException ex)
{
Console.WriteLine($"Operation timed out after {ex.Timeout?.TotalSeconds ?? 0} seconds");
// Retry with longer timeout
Console.WriteLine("Retrying with 30 second timeout...");
result = await curl.ExecuteAsync("curl --max-time 30 https://slow-server.com/large-file");
}
Remarks
This can occur for connection timeout or total operation timeout.
Curl error code: CURLE_OPERATION_TIMEDOUT (28)
AI-Usage: Catch this to implement retry with longer timeout or fail fast.
AI-Pattern: Log timeout value to help diagnose if timeout is too short.
| Constructors | |
|---|---|
| CurlTimeoutException(string, string, Nullable<TimeSpan>) | Initializes a new instance of the CurlTimeoutException class. |
| CurlTimeoutException(SerializationInfo, StreamingContext) | Initializes a new instance with serialized data. |
| Properties | |
|---|---|
| Timeout | Gets the timeout duration that was exceeded. |
| Methods | |
|---|---|
| GetObjectData(SerializationInfo, StreamingContext) | Sets the System.Runtime.Serialization.SerializationInfo with information about the exception. |