org.knowm.xchange.bitmex.BitmexException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-bitmex Show documentation
Show all versions of xchange-bitmex Show documentation
XChange implementations for the BitMex Exchange.
The newest version!
package org.knowm.xchange.bitmex;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;
import si.mazi.rescu.HttpResponseAware;
import si.mazi.rescu.HttpStatusException;
import si.mazi.rescu.HttpStatusExceptionSupport;
@SuppressWarnings("serial")
public class BitmexException extends HttpStatusExceptionSupport
implements HttpStatusException, HttpResponseAware {
@JsonProperty("error")
private Error error;
private Map> headers;
private int httpStatusCode;
public int getHttpStatusCode() {
return httpStatusCode;
}
public void setHttpStatusCode(int httpStatusCode) {
this.httpStatusCode = httpStatusCode;
}
public BitmexException(@JsonProperty("error") Error error) {
this.error = error;
}
public String getErrorName() {
return error.name;
}
@Override
public String getMessage() {
return (error.message == null ? error.name : error.message)
+ " (HTTP: "
+ httpStatusCode
+ ").";
}
@Override
public void setResponseHeaders(Map> headers) {
this.headers = headers;
}
@Override
public Map> getResponseHeaders() {
return headers;
}
static class Error {
@JsonProperty("message")
private String message;
@JsonProperty("name")
private String name;
public Error(@JsonProperty("message") String message, @JsonProperty("name") String name) {
this.message = message;
this.name = name;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy