Читати англійською

Поділитися через


AutoClientException Class

Definition

The exception that's thrown when REST API requests aren't successful.

C#
public class AutoClientException : Exception
Inheritance
AutoClientException

Examples

try
{
    await _myClient.SendRequest();
}
catch (AutoClientException ex) when (ex.StatusCode == 403)
{
    // Handle forbidden scenario
}

Remarks

This exception is thrown whenever a REST API call returns a non-successful status code. It contains the status code and the HTTP content returned by the dependency, so that the user can handle exceptions accordingly.

Constructors

Properties

HttpError

Gets the HTTP response.

Path

Gets the initial path of the HTTP request.

StatusCode

Gets the HTTP status code.

Applies to

Продукт Версії
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)