improve exception handling

Push it down from needing to be done in every Storer,
to being checked once inside ChunkedEncryptable.

Also, catch exceptions from PrepareStorer and PrepareRetriever,
just in case..
This commit is contained in:
Joey Hess 2014-07-26 23:26:10 -04:00
parent 7496355031
commit 9a8c4bb21f
3 changed files with 18 additions and 8 deletions

View file

@ -117,7 +117,7 @@ store d chunkconfig k b p = do
void $ tryIO $ createDirectoryIfMissing True tmpdir
case chunkconfig of
LegacyChunks chunksize -> Legacy.store chunksize finalizer k b p tmpdir destdir
_ -> flip catchNonAsync (\e -> warningIO (show e) >> return False) $ do
_ -> do
let tmpf = tmpdir </> keyFile k
meteredWriteFile p tmpf b
finalizer tmpdir destdir