com.coingi.exchange.client.ApiCallException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client Show documentation
Show all versions of client Show documentation
This is a Java library for interacting with Coingi.com HTTP API
The newest version!
package com.coingi.exchange.client;
import com.coingi.exchange.client.entities.Error;
import java.util.Collection;
import java.util.Collections;
import java.util.StringJoiner;
/**
* Response exception - the API returned a non-200 response.
*/
public class ApiCallException extends ClientException {
private final int statusCode;
private final Collection errors;
public ApiCallException(int statusCode) {
this(statusCode, Collections.emptyList());
}
public ApiCallException(int statusCode, Collection errors) {
super("There was a problem performing the request.");
this.statusCode = statusCode;
this.errors = Collections.unmodifiableCollection(errors);
}
public int getStatusCode() {
return statusCode;
}
public Collection getErrors() {
return errors;
}
@Override
public String toString() {
final StringJoiner joiner = new StringJoiner(",", "ApiCallException{", "}");
for (final Error error : errors) {
joiner.add(String.format("%d:%s", error.getCode(), error.getMessage()));
}
return joiner.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy