Share via


NetworkCallError Class

  • java.lang.Object
    • com.azure.core.test.models.NetworkCallError

Implements

public class NetworkCallError
implements JsonSerializable<NetworkCallError>

This class represents a caught throwable during a network call. It is used to serialize exceptions that were thrown during the pipeline and deserialize them back into their actual throwable class when running in playback mode.

Constructor Summary

Constructor Description
NetworkCallError()

Empty constructor used by deserialization.

NetworkCallError(Throwable throwable)

Constructs the class setting the throwable and its class name.

Method Summary

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

Deserializes an instance of NetworkCallError from the input JSON.

Throwable get()
void setClassName(String className)

Sets the name of the class of the throwable.

void setErrorMessage(String errorMessage)

Sets the error message of the class of the throwable.

void setThrowable(Throwable throwable)

Sets the throwable that was thrown during a network call.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

NetworkCallError

public NetworkCallError()

Empty constructor used by deserialization.

NetworkCallError

public NetworkCallError(Throwable throwable)

Constructs the class setting the throwable and its class name.

Parameters:

throwable - Throwable thrown during a network call.

Method Details

fromJson

public static NetworkCallError fromJson(JsonReader jsonReader)

Deserializes an instance of NetworkCallError from the input JSON.

Parameters:

jsonReader - The JSON reader to deserialize the data from.

Returns:

An instance of NetworkCallError deserialized from the JSON.

Throws:

IOException

- If the JSON reader encounters an error while reading the JSON.

get

public Throwable get()

Returns:

the thrown throwable as the class it was thrown as by converting is using its class name.

setClassName

public void setClassName(String className)

Sets the name of the class of the throwable. This is used during deserialization the construct the throwable as the actual class that was thrown.

Parameters:

className - Class name of the throwable.

setErrorMessage

public void setErrorMessage(String errorMessage)

Sets the error message of the class of the throwable. This is used during deserialization the construct the throwable as the actual class that was thrown.

Parameters:

errorMessage - Error msg from the exception.

setThrowable

public void setThrowable(Throwable throwable)

Sets the throwable that was thrown during a network call.

Parameters:

throwable - Throwable that was thrown.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to