withLogger handles errors.

This commit is contained in:
Kazu Yamamoto
2014-04-28 13:52:28 +09:00
parent 000076223f
commit fc570551a2
4 changed files with 23 additions and 27 deletions

View File

@@ -168,16 +168,12 @@ checkStx :: Options
-> FilePath
-> Ghc (String, Bool, Set FilePath)
checkStx opt set file = do
GE.ghandle handler $ do
(set',add) <- removeMainTarget file set
let files = if add then [file] else []
ret <- withLogger opt setAllWaringFlags $ addTargetFiles files
return (ret, True, set')
where
handler :: SourceError -> Ghc (String, Bool, Set FilePath)
handler err = do
ret <- handleErrMsg opt err
return (ret, True, set)
(set',add) <- removeMainTarget file set
let files = if add then [file] else []
eret <- withLogger opt setAllWaringFlags $ addTargetFiles files
case eret of
Right ret -> return (ret, True, set')
Left ret -> return (ret, True, set) -- fxime: set
removeMainTarget :: FilePath -> Set FilePath -> Ghc (Set FilePath, Bool)
removeMainTarget file set = do