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:
parent
3334d3831b
commit
cdbfaae706
11 changed files with 70 additions and 59 deletions
|
@ -337,10 +337,12 @@ startUnexport' r db f ek = starting ("unexport " ++ name r) (ActionItemOther (Ju
|
|||
-- not really remove the content, which must be accessible later on.
|
||||
performUnexport :: Remote -> ExportHandle -> [ExportKey] -> ExportLocation -> CommandPerform
|
||||
performUnexport r db eks loc = do
|
||||
ifM (allM (\ek -> removeExport (exportActions r) (asKey ek) loc) eks)
|
||||
ifM (allM rm eks)
|
||||
( next $ cleanupUnexport r db eks loc
|
||||
, stop
|
||||
)
|
||||
where
|
||||
rm ek = Remote.action $ removeExport (exportActions r) (asKey ek) loc
|
||||
|
||||
cleanupUnexport :: Remote -> ExportHandle -> [ExportKey] -> ExportLocation -> CommandCleanup
|
||||
cleanupUnexport r db eks loc = do
|
||||
|
|
|
@ -285,7 +285,7 @@ testExportTree runannex mkr mkk1 mkk2 =
|
|||
[ check "check present export when not present" $ \ea k1 _k2 ->
|
||||
not <$> checkpresentexport ea k1
|
||||
, check "remove export when not present" $ \ea k1 _k2 ->
|
||||
removeexport ea k1
|
||||
isRight <$> tryNonAsync (removeexport ea k1)
|
||||
, check "store export" $ \ea k1 _k2 ->
|
||||
isRight <$> tryNonAsync (storeexport ea k1)
|
||||
, check "check present export after store" $ \ea k1 _k2 ->
|
||||
|
@ -301,7 +301,7 @@ testExportTree runannex mkr mkk1 mkk2 =
|
|||
, check "retrieve export new content" $ \ea _k1 k2 ->
|
||||
retrieveexport ea k2
|
||||
, check "remove export" $ \ea _k1 k2 ->
|
||||
removeexport ea k2
|
||||
isRight <$> tryNonAsync (removeexport ea k2)
|
||||
, check "check present export after remove" $ \ea _k1 k2 ->
|
||||
not <$> checkpresentexport ea k2
|
||||
, check "retrieve export fails after removal" $ \ea _k1 k2 ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue