mirror of
https://github.com/google/nomulus
synced 2026-02-04 03:52:33 +00:00
Improve exception message when TMDB not available
We saw a few IOExceptions recently which indicated that TMDB may be down at that time. However, these IOExceptions didn't have any message to clearly describe that. This CL is to improve the exception message so next time we don't have to look at the source code to figure out what happened. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=241984023
This commit is contained in:
@@ -115,7 +115,13 @@ public final class Marksdb {
|
||||
byte[] fetch(URL url, Optional<String> loginAndPassword) throws IOException {
|
||||
HTTPRequest req = new HTTPRequest(url, GET, validateCertificate().setDeadline(60d));
|
||||
setAuthorizationHeader(req, loginAndPassword);
|
||||
HTTPResponse rsp = fetchService.fetch(req);
|
||||
HTTPResponse rsp;
|
||||
try {
|
||||
rsp = fetchService.fetch(req);
|
||||
} catch (IOException e) {
|
||||
throw new IOException(
|
||||
String.format("Error connecting to MarksDB at URL %s", url), e);
|
||||
}
|
||||
if (rsp.getResponseCode() != SC_OK) {
|
||||
throw new UrlFetchException("Failed to fetch from MarksDB", req, rsp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user