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>
This class represents the error details of an HTTP response.
  • 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
      Description copied from interface: com.azure.json.JsonSerializable
      Writes the object to the passed JsonWriter.

      The contract for writing JSON to JsonWriter is that the object being written will handle opening and closing its own JSON object. So, for objects calling out to other JsonSerializable objects for serialization, they'll write the field name only then pass the JsonWriter to the other JsonSerializable object. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.

      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ResponseError>
      Parameters:
      jsonWriter - Where the object's JSON will be written.
      Returns:
      The JsonWriter where the JSON was written.
      Throws:
      IOException - If the object fails to be written to the jsonWriter.
    • 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.