diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/pipeline/get.go | 10 |
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 } |