return retrieveAccountListForVersion(apiVersion);
}
}
- private List<LedgerAccount> retrieveAccountListAnyVersion()
- throws HTTPException, ApiNotSupportedException {
+ private List<LedgerAccount> retrieveAccountListAnyVersion() throws ApiNotSupportedException {
for (API ver : API.allVersions) {
try {
return retrieveAccountListForVersion(ver);
ver.getDescription()));
}
- throw new ApiNotSupportedException();
}
- throw new RuntimeException("This should never be reached");
+ throw new ApiNotSupportedException();
}
private List<LedgerAccount> retrieveAccountListForVersion(API version)
throws IOException, HTTPException {
try {
return retrieveTransactionListForVersion(ver);
}
- catch (Exception | HTTPException e) {
+ catch (Exception e) {
Logger.debug("json",
String.format(Locale.US, "Error during account list retrieval using API %s",
ver.getDescription()));
}
- throw new ApiNotSupportedException();
}
- throw new RuntimeException("This should never be reached");
+ throw new ApiNotSupportedException();
}
private List<LedgerTransaction> retrieveTransactionListForVersion(API apiVersion)
throws IOException, ParseException, HTTPException {
}
catch (HTTPException e) {
e.printStackTrace();
- return new Result(String.format("HTTP error %d: %s", e.getResponseCode(),
- e.getResponseMessage()));
+ return new Result(
+ String.format("HTTP error %d: %s", e.getResponseCode(), e.getMessage()));
}
catch (IOException e) {
e.printStackTrace();
/*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
package net.ktnx.mobileledger.err;
-public class HTTPException extends Throwable {
+public class HTTPException extends Exception {
private final int responseCode;
- private final String responseMessage;
public int getResponseCode() {
return responseCode;
}
- public String getResponseMessage() {
- return responseMessage;
- }
public HTTPException(int responseCode, String responseMessage) {
+ super(responseMessage);
this.responseCode = responseCode;
- this.responseMessage = responseMessage;
}
}