39 lines
963 B
Java
39 lines
963 B
Java
|
package retrofit2;
|
||
|
|
||
|
import java.util.Objects;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class HttpException extends RuntimeException {
|
||
|
private final int code;
|
||
|
private final String message;
|
||
|
private final transient Response<?> response;
|
||
|
|
||
|
private static String getMessage(Response<?> response) {
|
||
|
Objects.requireNonNull(response, "response == null");
|
||
|
StringBuilder sb = new StringBuilder("HTTP ");
|
||
|
sb.append(response.code());
|
||
|
sb.append(" ");
|
||
|
sb.append(response.message());
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
public HttpException(Response<?> response) {
|
||
|
super(getMessage(response));
|
||
|
this.code = response.code();
|
||
|
this.message = response.message();
|
||
|
this.response = response;
|
||
|
}
|
||
|
|
||
|
public Response<?> response() {
|
||
|
return this.response;
|
||
|
}
|
||
|
|
||
|
public String message() {
|
||
|
return this.message;
|
||
|
}
|
||
|
|
||
|
public int code() {
|
||
|
return this.code;
|
||
|
}
|
||
|
}
|