com.xeiam.xchange.bitstamp.dto.BitstampException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-bitstamp Show documentation
Show all versions of xchange-bitstamp Show documentation
XChange implementation for the Bitstamp Exchange
package com.xeiam.xchange.bitstamp.dto;
import java.util.Collection;
import java.util.Map;
import si.mazi.rescu.HttpStatusExceptionSupport;
import com.fasterxml.jackson.annotation.JsonProperty;
public class BitstampException extends HttpStatusExceptionSupport {
private Map> errors;
public BitstampException(@JsonProperty("error") Object error) {
super(getMessage(error));
if (error instanceof Map) {
try {
errors = (Map>) error;
} catch (Exception ignore) {
}
}
}
private static String getMessage(Object errors) {
if (errors instanceof Map) {
try {
Map map = (Map) errors;
final StringBuilder sb = new StringBuilder();
for (String key : map.keySet()) {
for (Object msg : map.get(key)) {
if (sb.length() > 0) {
sb.append(" -- ");
}
sb.append(msg);
}
}
return sb.toString();
} catch (Exception ignore) {
}
}
return String.valueOf(errors);
}
public Map> getErrors() {
return errors;
}
public Collection getErrors(String key) {
return errors.get(key);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy