Partilhar via


com.azure.core.exception

This package contains the core exception classes used throughout the Azure SDKs.

These exceptions are typically thrown in response to errors that occur when interacting with Azure services. For example, if a network request to an Azure service fails an exception from this package is thrown. The specific exception that is thrown depends on the nature of the error.

Here are some of the key exceptions included in this package:

  • AzureException: The base class for all exceptions thrown by Azure SDKs.
  • HttpRequestException: Represents an exception thrown when an HTTP request fails.
  • HttpResponseException: Represents an exception thrown when an unsuccessful HTTP response is received from a service request.
  • ResourceExistsException: Represents an exception thrown when an HTTP request attempts to create a resource that already exists.
  • ResourceNotFoundException: Represents an exception thrown when an HTTP request attempts to access a resource that does not exist.

Some exceptions (noted in their documentation) include the HTTP request or response that led to the exception.

Classes

AzureException

The AzureException class is the base class for all exceptions thrown by Azure SDKs.

ClientAuthenticationException

The ClientAuthenticationException represents an exception thrown when client authentication fails with a status code of 4XX, typically 401 unauthorized.

DecodeException

The DecodeException represents an exception thrown when the HTTP response could not be decoded during the deserialization process.

HttpRequestException

The HttpRequestException that represents an exception thrown when an HTTP request fails.

HttpResponseException

The HttpResponseException represents an exception thrown when an unsuccessful HTTP response is received from a service request.

ResourceExistsException

The ResourceExistsException represents an exception thrown when an HTTP request attempts to create a resource that already exists.

ResourceModifiedException

The ResourceModifiedException represents an exception thrown when an HTTP request attempts to modify a resource in a way that is not allowed.

ResourceNotFoundException

The ResourceNotFoundException represents an exception thrown when an HTTP request attempts to access a resource that does not exist.

ServiceResponseException

The ServiceResponseException represents an exception thrown when the client fails to understand the service response or the connection times out.

TooManyRedirectsException

The TooManyRedirectsException represents an exception thrown when an HTTP request has reached the maximum number of redirect attempts.

UnexpectedLengthException

The UnexpectedLengthException represents an exception thrown when the specified input length doesn't match the actual data length.