public final class Result<T> extends Object
Modifier and Type | Field and Description |
---|---|
private Throwable |
error |
private retrofit2.Response<T> |
response |
Modifier | Constructor and Description |
---|---|
private |
Result(retrofit2.Response<T> response,
Throwable error) |
Modifier and Type | Method and Description |
---|---|
Throwable |
error()
The error experienced while attempting to execute an HTTP request.
|
static <T> Result<T> |
error(Throwable error) |
boolean |
isError()
true if the request resulted in an error. |
retrofit2.Response<T> |
response()
The response received from executing an HTTP request.
|
static <T> Result<T> |
response(retrofit2.Response<T> response) |
@Nullable private final retrofit2.Response<T> response
@Nullable private final Throwable error
public static <T> Result<T> response(retrofit2.Response<T> response)
@Nullable public retrofit2.Response<T> response()
isError()
is
false, null otherwise.@Nullable public Throwable error()
isError()
is true, null otherwise.
If the error is an IOException
then there was a problem with the transport to the
remote server. Any other exception type indicates an unexpected failure and should be
considered fatal (configuration error, programming error, etc.).
public boolean isError()
true
if the request resulted in an error. See error()
for the cause.Copyright © 2025. All rights reserved.