Class ResponseError

java.lang.Object
com.azure.core.models.ResponseError
All Implemented Interfaces:
com.azure.json.JsonSerializable<ResponseError>

public final class ResponseError extends Object implements com.azure.json.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) method to serialize the error details to JSON, and a fromJson(JsonReader) method to deserialize the error details from JSON.

See Also:
  • JsonSerializable
  • JsonReader
  • JsonWriter
  • 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

    • 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 com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ResponseError>
      Throws:
      IOException
    • fromJson

      public static ResponseError fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      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:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If a ResponseError fails to be read from the jsonReader.