summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-18 11:44:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-18 11:44:21 -0400
commit00340dfe493ad71a55f4de2c352fc186792363cd (patch)
treeca2075bbf0e4784d578dea5ea7bb102b84e5180a /Command
parent0fada4380884758e1e51bff6f8ca708f07425e40 (diff)
don't error out entirely if an url cannot be downloaded
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 3d484a1d3..459fbc623 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -80,11 +80,14 @@ download url file = do
nodownload :: String -> FilePath -> CommandPerform
nodownload url file = do
(exists, size) <- liftIO $ Url.exists url
- unless exists $
- error $ "unable to access url: " ++ url
- let key = Backend.URL.fromUrl url size
- setUrlPresent key url
- next $ Command.Add.cleanup file key False
+ if exists
+ then do
+ let key = Backend.URL.fromUrl url size
+ setUrlPresent key url
+ next $ Command.Add.cleanup file key False
+ else do
+ warning $ "unable to access url: " ++ url
+ stop
url2file :: URI -> Maybe Int -> FilePath
url2file url pathdepth = case pathdepth of