Skip to content

Commit

Permalink
fix(artifact): improve error messaging for failed artifact downl… (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
maggieneterval authored and ethanfrogers committed Oct 23, 2019
1 parent 7e5d3da commit 00dbfde
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Component;
import retrofit.RetrofitError;
import retrofit.client.Response;

@Component
Expand All @@ -30,8 +31,16 @@ public void downloadArtifact(Artifact artifact, Path targetFile) throws IOExcept
if (response.getBody() != null) {
try (InputStream inputStream = response.getBody().in()) {
IOUtils.copy(inputStream, outputStream);
} catch (IOException e) {
throw new IOException(
String.format(
"Failed to read input stream of downloaded artifact: %s. Error: %s",
artifact, e.getMessage()));
}
}
} catch (RetrofitError e) {
throw new IOException(
String.format("Failed to download artifact: %s. Error: %s", artifact, e.getMessage()));
}
}
}

0 comments on commit 00dbfde

Please sign in to comment.