audit all uses of SomeException to avoid catching async exceptions

Except for the assistant, which I think may use them between threads?

Most of the uses of SomeException were already catching only async exceptions.
But I did find a few places that were accidentially catching them.
This commit is contained in:
Joey Hess 2020-06-05 15:16:57 -04:00
parent dca19099a9
commit 319f2a4afc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 4 additions and 7 deletions

View file

@ -12,7 +12,6 @@ import Remote.Helper.Chunked
import Utility.Metered
import qualified Data.ByteString.Lazy as L
import qualified Control.Exception as E
{- This is an extension that's added to the usual file (or whatever)
- where the remote stores a key. -}
@ -87,8 +86,8 @@ storeChunks key tmp dest storer recorder finalizer = do
- writes a whole L.ByteString at a time.
-}
storeChunked :: ChunkSize -> [FilePath] -> (FilePath -> L.ByteString -> IO ()) -> L.ByteString -> IO [FilePath]
storeChunked chunksize dests storer content = either onerr return
=<< (E.try (go (Just chunksize) dests) :: IO (Either E.SomeException [FilePath]))
storeChunked chunksize dests storer content =
either onerr return =<< tryNonAsync (go (Just chunksize) dests)
where
go _ [] = return [] -- no dests!?
go Nothing (d:_) = do