smp server: log file name on hClose error

This commit is contained in:
Evgeny Poberezkin
2024-10-28 10:25:15 +00:00
parent 6ff4c3f1ce
commit d49dc201c3

View File

@@ -632,7 +632,10 @@ openFile f mode = do
pure h
hClose :: Handle -> IO ()
hClose h = IO.hClose h `catchAny` (\e -> logError $ "STORE: hClose, error closing file, " <> tshow e)
hClose h =
IO.hClose h `catchAny` \e -> do
name <- IO.hShow h
logError $ "STORE: hClose, " <> T.pack name <> ", " <> tshow e
closeOnException :: Handle -> IO a -> IO a
closeOnException h a = a `E.onException` hClose h