String code = d.getRootElement().getChildText("Code");
String message = d.getRootElement().getChildText("Message");
if (code == null && message == null) {
// not an error from ESU
throw new EsuException(con.getResponseMessage(), http_code);
}
l4j.debug("Error: " + code + " message: " + message);
throw new EsuException(message, http_code, Integer.parseInt(code));
} catch (IOException e) {
l4j.debug("Could not read error response body", e);
// Just throw what we know from the response
try {
throw new EsuException(con.getResponseMessage(), http_code);
} catch (IOException e1) {
l4j.warn("Could not get response code/message!", e);
throw new EsuException("Could not get response code", e,
http_code);
}
} catch (JDOMException e) {
try {
l4j.debug("Could not parse response body for " + http_code
+ ": " + con.getResponseMessage(), e);
throw new EsuException("Could not parse response body for "
+ http_code + ": " + con.getResponseMessage(), e,
http_code);
} catch (IOException e1) {
throw new EsuException("Could not parse response body", e1,
http_code);
}
}