Log exceptions in `browse`

This commit is contained in:
Daniel Gröber 2015-11-26 16:19:11 +01:00
parent 87b5b6f8c5
commit 412cee9abf
1 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import Language.Haskell.GhcMod.Doc (showPage, styleUnqualified)
import Language.Haskell.GhcMod.Gap as Gap
import Language.Haskell.GhcMod.Monad
import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Logging
import Name (getOccString)
import Outputable
import TyCon (isAlgTyCon)
@ -35,9 +36,12 @@ browse pkgmdl = do
where
-- TODO: Add API to Gm.Target to check if module is home module without
-- bringing up a GHC session as well then this can be made a lot cleaner
go = ghandle (\(SomeException _) -> return []) $ do
go = ghandle (\ex@(SomeException _) -> logException ex >> return []) $ do
goPkgModule `G.gcatch` (\(SomeException _) -> goHomeModule)
logException ex =
gmLog GmException "browse" $ showDoc ex
goPkgModule = do
opt <- options
runGmPkgGhc $