change removeExport to throw exception

Part of ongoing transition to make remote methods
throw exceptions, rather than silently hide them.

This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
Joey Hess 2020-05-15 14:11:59 -04:00
parent 3334d3831b
commit cdbfaae706
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 70 additions and 59 deletions

View file

@ -239,7 +239,9 @@ data ExportActions a = ExportActions
-- Throws exception on failure.
, retrieveExport :: Key -> ExportLocation -> FilePath -> MeterUpdate -> a ()
-- Removes an exported file (succeeds if the contents are not present)
, removeExport :: Key -> ExportLocation -> a Bool
-- Can throw exception if unable to access remote, or if remote
-- refuses to remove the content.
, removeExport :: Key -> ExportLocation -> a ()
-- Removes an exported directory. Typically the directory will be
-- empty, but it could possibly contain files or other directories,
-- and it's ok to delete those (but not required to).
@ -315,11 +317,13 @@ data ImportActions a = ImportActions
-- can recover an overwritten file.
--
-- It needs to handle races similar to storeExportWithContentIdentifier.
--
-- Throws an exception when unable to remove.
, removeExportWithContentIdentifier
:: Key
-> ExportLocation
-> [ContentIdentifier]
-> a Bool
-> a ()
-- Removes a directory from the export, but only when it's empty.
-- Used instead of removeExportDirectory when a special remote
-- supports imports.