Freigeben über


ResponseError Class

  • java.lang.Object
    • com.azure.core.models.ResponseError

Implements

public final class ResponseError
implements JsonSerializable<ResponseError>

Represents the error details of an HTTP response.

This class encapsulates the details of an HTTP error response, including the error code, message, target, inner error, and additional error details. It provides methods to access these properties.

This class also provides a toJson(JsonWriter jsonWriter) method to serialize the error details to JSON, and a fromJson(JsonReader jsonReader) method to deserialize the error details from JSON.

Constructor Summary

Constructor Description
ResponseError(String code, String message)

Creates an instance of ResponseError.

Method Summary

Modifier and Type Method and Description
static ResponseError fromJson(JsonReader jsonReader)

Reads a JSON stream into a ResponseError.

String getCode()

Returns the error code of this error.

String getMessage()

Returns the error message of this error.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

ResponseError

public ResponseError(String code, String message)

Creates an instance of ResponseError.

Parameters:

code - the error code of this error.
message - the error message of this error.

Method Details

fromJson

public static ResponseError fromJson(JsonReader jsonReader)

Reads a JSON stream into a ResponseError.

Parameters:

jsonReader - The JsonReader being read.

Returns:

The ResponseError that the JSON stream represented, or null if it pointed to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getCode

public String getCode()

Returns the error code of this error.

Returns:

the error code of this error.

getMessage

public String getMessage()

Returns the error message of this error.

Returns:

the error message of this error.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to