summaryrefslogtreecommitdiff
path: root/internal/pipeline/get.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2022-01-10 16:15:52 +0000
committerNick White <git@njw.name>2022-01-10 16:15:52 +0000
commit436551c5e6f9d96f82fdf31e01e422b2a937b6ee (patch)
tree00e0a152ef907ff9a073d7817a6ab5753e3858c4 /internal/pipeline/get.go
parentdc7b313c504d68165f1d1b085a6ce94eb6e8b55f (diff)
internal/pipeline: Have DownloadPdfs() try to download all PDFs, but only return an error if none downloaded, as there are times when the colour PDF will not exist, which is fine
Diffstat (limited to 'internal/pipeline/get.go')
-rw-r--r--internal/pipeline/get.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/pipeline/get.go b/internal/pipeline/get.go
index e9bb8b1..5e43c2b 100644
--- a/internal/pipeline/get.go
+++ b/internal/pipeline/get.go
@@ -66,14 +66,22 @@ func DownloadBestPngs(dir string, name string, conn Downloader) error {
}
func DownloadPdfs(dir string, name string, conn Downloader) error {
+ anydone := false
+ errmsg := ""
for _, suffix := range []string{".colour.pdf", ".binarised.pdf"} {
key := filepath.Join(name, name+suffix)
fn := filepath.Join(dir, name+suffix)
err := conn.Download(conn.WIPStorageId(), key, fn)
if err != nil {
- return fmt.Errorf("Failed to download PDF %s: %v", key, err)
+ _ = os.Remove(fn)
+ errmsg += fmt.Sprintf("Failed to download PDF %s: %v\n", key, err)
+ } else {
+ anydone = true
}
}
+ if anydone == false {
+ return fmt.Errorf("No PDFs could be downloaded, error(s): %v", errmsg)
+ }
return nil
}