Skip to content

Commit ac44a69

Browse files
committed
log hiedb exceptions before killing the server
1 parent 3e3d782 commit ac44a69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ghcide/src/Development/IDE/LSP/LanguageServer.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ runLanguageServer options inH outH getHieDbLoc defaultConfig onConfigurationChan
141141
logInfo (ideLogger ide) $ T.pack $ "Registering ide configuration: " <> show initConfig
142142
registerIdeConfiguration (shakeExtras ide) initConfig
143143

144-
_ <- flip forkFinally (const exitClientMsg) $ runWithDb dbLoc $ \hiedb hieChan -> do
144+
let handleHieDbException e = do
145+
logError (ideLogger ide) (T.pack $ "Unexpected exception in hiedb thread: " <> show e)
146+
exitClientMsg
147+
_ <- flip forkFinally handleHieDbException $ runWithDb dbLoc $ \hiedb hieChan -> do
145148
putMVar dbMVar (hiedb,hieChan)
146149
forever $ do
147150
msg <- readChan clientMsgChan

0 commit comments

Comments
 (0)