Skip to content
This repository was archived by the owner on Jul 11, 2024. It is now read-only.

Add URL to storage exceptions since error responses usually only have… #509

Merged
merged 1 commit into from
Feb 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public CompletableFuture<FileWriter> createFile(
ResponseHeaders responseHeaders = msg.headers();
if (!responseHeaders.status().equals(HttpStatus.OK)) {
throw new RuntimeException(
"Non-successful response when creating new file: "
"Non-successful response when creating new file at "
+ uploadUrl
+ ": "
+ responseHeaders
+ "\n"
+ msg.content().toStringUtf8());
Expand Down Expand Up @@ -172,7 +174,8 @@ public CompletableFuture<ByteBuf> readFile(
if (!msg.status().equals(HttpStatus.OK)) {
String response = msg.contentUtf8();
ReferenceCountUtil.safeRelease(msg.content());
throw new InvalidResponseException("Could not fetch file: " + response);
throw new InvalidResponseException(
"Could not fetch file at " + filename + ": " + response);
}
HttpData data = msg.content();
if (data instanceof ByteBufHolder) {
Expand Down Expand Up @@ -231,7 +234,7 @@ public CompletableFuture<Void> delete(String filename) {
return null;
} else {
throw new IllegalStateException(
"Could not delete file: " + msg.content().toStringUtf8());
"Could not delete file at " + url + ": " + msg.content().toStringUtf8());
}
});
}
Expand All @@ -254,7 +257,7 @@ private CompletableFuture<Void> sendMutationRequest(
return null;
} else {
throw new IllegalStateException(
"Could not compose file: " + msg.content().toStringUtf8());
"Could not compose file at " + url + ": " + msg.content().toStringUtf8());
}
} finally {
ReferenceCountUtil.safeRelease(msg.content());
Expand Down