Package com.azure.core.models
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 Summary
ConstructorsConstructorDescriptionResponseError(String code, String message) Creates an instance ofResponseError. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResponseErrorfromJson(com.azure.json.JsonReader jsonReader) Reads a JSON stream into aResponseError.getCode()Returns the error code of this error.Returns the error message of this error.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Writes the object to the passedJsonWriter.
-
Constructor Details
-
ResponseError
Creates an instance ofResponseError.- Parameters:
code- the error code of this error.message- the error message of this error.
-
-
Method Details
-
getCode
Returns the error code of this error.- Returns:
- the error code of this error.
-
getMessage
Returns the error message of this error.- Returns:
- the error message of this error.
-
toJson
Description copied from interface:com.azure.json.JsonSerializableWrites the object to the passedJsonWriter.The contract for writing JSON to
JsonWriteris that the object being written will handle opening and closing its own JSON object. So, for objects calling out to otherJsonSerializableobjects for serialization, they'll write the field name only then pass theJsonWriterto the otherJsonSerializableobject. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<ResponseError>- Parameters:
jsonWriter- Where the object's JSON will be written.- Returns:
- The
JsonWriterwhere the JSON was written. - Throws:
IOException- If the object fails to be written to thejsonWriter.
-
fromJson
Reads a JSON stream into aResponseError.- Parameters:
jsonReader- TheJsonReaderbeing read.- Returns:
- The
ResponseErrorthat 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 aResponseErrorfails to be read from thejsonReader.
-