From 9608c0f0410cb35ae5f5c9233ee2ffd7a0b76116 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 17 Aug 2011 06:38:01 -0400 Subject: [PATCH] When a file is missing the ftp client throws an error, catch it. --- collects/meta/web/download/mirror-link.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/collects/meta/web/download/mirror-link.rkt b/collects/meta/web/download/mirror-link.rkt index 71b58e72fc..f5a5c4448d 100644 --- a/collects/meta/web/download/mirror-link.rkt +++ b/collects/meta/web/download/mirror-link.rkt @@ -154,10 +154,12 @@ Polling a URL can result in one of four options: (error 'verify-ftp "bad ftp url: ~a" url))))) (define port (or port? 21)) (define r - (let ([c (ftp-establish-connection host port "anonymous" "anonymous@")]) - (begin0 (ftp-directory-list c path) (ftp-close-connection c)))) + (with-handlers ([exn:fail? exn-message]) + (let ([c (ftp-establish-connection host port "anonymous" "anonymous@")]) + (begin0 (ftp-directory-list c path) (ftp-close-connection c))))) (cond [(not (and (list? r) (= 1 (length r)) (list? (car r)))) - (eprintf "WARNING: failure getting ftp info for ~a\n" url) + (eprintf "WARNING: failure getting ftp info for ~a~a\n" + url (if (string? r) (format " (~a)" r) "")) #f] [(not (= 4 (length (car r)))) (eprintf "WARNING: no size for: ~a\n" url)