Udostępnij za pośrednictwem


AutoClientException Class

Definition

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

public ref class AutoClientException : Exception
public class AutoClientException : Exception
type AutoClientException = class
    inherit Exception
Public Class AutoClientException
Inherits 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

AutoClientException(String, Exception, String, AutoClientHttpError)

Initializes a new instance of the AutoClientException class.

AutoClientException(String, String, AutoClientHttpError)

Initializes a new instance of the AutoClientException class.

Properties

HttpError

Gets the HTTP response.

Path

Gets the initial path of the HTTP request.

StatusCode

Gets the HTTP status code.

Applies to