Skip to content

Commit 9e6c6c1

Browse files
authored
Avoid printing AsyncCancelled stacktraces on restart (#4919)
1 parent a0ec0a0 commit 9e6c6c1

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,12 @@ instance Pretty Log where
223223
hsep
224224
[ "Finished:" <+> pretty (actionName delayedAct)
225225
, "Took:" <+> pretty (showDuration seconds) ]
226-
LogBuildSessionFinish e ->
227-
vcat
226+
LogBuildSessionFinish e -> case e of
227+
Nothing -> "Finished build session"
228+
Just e -> vcat
228229
[ "Finished build session"
229-
, pretty (fmap displayException e) ]
230+
, pretty (displayException e)
231+
]
230232
LogDiagsDiffButNoLspEnv fileDiagnostics ->
231233
"updateFileDiagnostics published different from new diagnostics - file diagnostics:"
232234
<+> pretty (showDiagnosticsColored fileDiagnostics)
@@ -909,8 +911,9 @@ newSession recorder extras@ShakeExtras{..} vfsMod shakeDb acts reason = do
909911
return $ do
910912
let exception =
911913
case res of
912-
Left e -> Just e
913-
_ -> Nothing
914+
Left (fromException -> Just AsyncCancelled) -> Nothing
915+
Left e -> Just e
916+
_ -> Nothing
914917
logWith recorder Debug $ LogBuildSessionFinish exception
915918

916919
-- Do the work in a background thread

0 commit comments

Comments
 (0)