catch whereisKey exception and provide error messages when external programs neglect to
* whereis: If a remote fails to report on urls where a key is located, display a warning, rather than giving up and not displaying any information. * When external special remotes fail but neglect to provide an error message, say what request failed, which is better than displaying an empty error message to the user.
This commit is contained in:
parent
bb20c16cf0
commit
2366e7fb84
3 changed files with 41 additions and 13 deletions
|
@ -92,7 +92,18 @@ getRemoteUrls key remote
|
|||
<$> askremote
|
||||
<*> claimedurls
|
||||
where
|
||||
askremote = maybe (pure []) (flip id key) (whereisKey remote)
|
||||
askremote = case whereisKey remote of
|
||||
Nothing -> pure []
|
||||
Just w -> tryNonAsync (w key) >>= \case
|
||||
Right l -> pure l
|
||||
Left e -> do
|
||||
warning $ unwords
|
||||
[ "unable to query remote"
|
||||
, name remote
|
||||
, "for urls:"
|
||||
, show e
|
||||
]
|
||||
return []
|
||||
claimedurls = do
|
||||
us <- map fst
|
||||
. filter (\(_, d) -> d == OtherDownloader)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue