
com.chain.sequence.exception.ConnectivityException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sequence-sdk Show documentation
Show all versions of sequence-sdk Show documentation
The Official Java SDK for Chain Core Developer Edition
The newest version!
package com.chain.sequence.exception;
import com.squareup.okhttp.Response;
import java.io.IOException;
/**
* ConnectivityException is thrown when the SDK is unable to communicate with
* the API server.
*/
public class ConnectivityException extends ChainException {
public ConnectivityException(Response resp) {
super(formatMessage(resp));
}
private static String formatMessage(Response resp) {
String s =
"Response HTTP header field Chain-Request-ID is unset. There may be network issues. Please check your local network settings.";
// TODO(kr): include client-generated reqid here once we have that.
String body;
try {
body = resp.body().string();
} catch (IOException ex) {
body = "[unable to read response body: " + ex.toString() + "]";
}
return String.format("%s status=%d body=%s", s, resp.code(), body);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy