importfeed: Move error to where --json-error-messages can capture it
Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
04ee6c4c6b
commit
6b54ea69e3
1 changed files with 13 additions and 13 deletions
|
@ -89,7 +89,7 @@ seek o = startConcurrency commandStages $ do
|
||||||
|
|
||||||
startpendingdownloads addunlockedmatcher cache dlst checkst True
|
startpendingdownloads addunlockedmatcher cache dlst checkst True
|
||||||
|
|
||||||
checkfeedproblems checkst
|
clearfeedproblems checkst
|
||||||
where
|
where
|
||||||
getpendingdownloads dlst blocking
|
getpendingdownloads dlst blocking
|
||||||
| blocking = do
|
| blocking = do
|
||||||
|
@ -128,15 +128,11 @@ seek o = startConcurrency commandStages $ do
|
||||||
commandAction $
|
commandAction $
|
||||||
startDownload addunlockedmatcher o cache cv i
|
startDownload addunlockedmatcher o cache cv i
|
||||||
|
|
||||||
checkfeedproblems checkst = do
|
clearfeedproblems checkst = do
|
||||||
m <- liftIO $ atomically $ readTVar checkst
|
m <- liftIO $ atomically $ readTVar checkst
|
||||||
forM_ (M.toList m) $ \(url, cvl) ->
|
forM_ (M.toList m) $ \(url, cvl) ->
|
||||||
ifM (and <$> mapM (liftIO . atomically . takeTMVar) cvl)
|
whenM (and <$> mapM (liftIO . atomically . takeTMVar) cvl) $
|
||||||
( clearFeedProblem url
|
clearFeedProblem url
|
||||||
-- FIXME: This will not be captured in json
|
|
||||||
, void $ feedProblem url
|
|
||||||
"problem downloading some item(s) from feed"
|
|
||||||
)
|
|
||||||
|
|
||||||
getFeed
|
getFeed
|
||||||
:: URLString
|
:: URLString
|
||||||
|
@ -407,8 +403,10 @@ runDownload todownload url extension cache cv getter = do
|
||||||
Just ks
|
Just ks
|
||||||
-- Download problem.
|
-- Download problem.
|
||||||
| null ks -> do
|
| null ks -> do
|
||||||
liftIO . atomically . putTMVar cv
|
broken <- checkFeedBroken (feedurl todownload)
|
||||||
=<< checkFeedBroken (feedurl todownload)
|
when broken $
|
||||||
|
void $ feedProblem url "download failed"
|
||||||
|
liftIO $ atomically $ putTMVar cv broken
|
||||||
next $ return False
|
next $ return False
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
forM_ ks $ \key ->
|
forM_ ks $ \key ->
|
||||||
|
@ -456,12 +454,14 @@ runDownload todownload url extension cache cv getter = do
|
||||||
)
|
)
|
||||||
|
|
||||||
startUrlDownload :: TMVar Bool -> URLString -> CommandPerform -> CommandStart
|
startUrlDownload :: TMVar Bool -> URLString -> CommandPerform -> CommandStart
|
||||||
startUrlDownload cv u a = starting "addurl"
|
startUrlDownload cv url a = starting "addurl"
|
||||||
(ActionItemOther (Just (UnquotedString u)))
|
(ActionItemOther (Just (UnquotedString url)))
|
||||||
(SeekInput [])
|
(SeekInput [])
|
||||||
(a `onException` recordfailure)
|
(a `onException` recordfailure)
|
||||||
where
|
where
|
||||||
recordfailure = liftIO $ atomically $ tryPutTMVar cv False
|
recordfailure = do
|
||||||
|
void $ feedProblem url "download failed"
|
||||||
|
liftIO $ atomically $ tryPutTMVar cv False
|
||||||
|
|
||||||
defaultTemplate :: String
|
defaultTemplate :: String
|
||||||
defaultTemplate = "${feedtitle}/${itemtitle}${extension}"
|
defaultTemplate = "${feedtitle}/${itemtitle}${extension}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue