convert renameExport to throw exception
Finishes the transition to make remote methods throw exceptions, rather than silently hide them. A bit on the fence about this one, because when renameExport fails, it falls back to deleting instead, and so does the user care why it failed? However, it did let me clean up several places in the code. This commit was sponsored by Ethan Aubin.
This commit is contained in:
parent
00448349de
commit
6361074174
11 changed files with 64 additions and 89 deletions
|
@ -396,13 +396,13 @@ startMoveFromTempName r db ek f = do
|
|||
|
||||
performRename :: Remote -> ExportHandle -> ExportKey -> ExportLocation -> ExportLocation -> CommandPerform
|
||||
performRename r db ek src dest =
|
||||
renameExport (exportActions r) (asKey ek) src dest >>= \case
|
||||
Just True -> next $ cleanupRename r db ek src dest
|
||||
Just False -> do
|
||||
warning "rename failed; deleting instead"
|
||||
tryNonAsync (renameExport (exportActions r) (asKey ek) src dest) >>= \case
|
||||
Right (Just ()) -> next $ cleanupRename r db ek src dest
|
||||
Left err -> do
|
||||
warning $ "rename failed (" ++ show err ++ "); deleting instead"
|
||||
fallbackdelete
|
||||
-- Remote does not support renaming, so don't warn about it.
|
||||
Nothing -> fallbackdelete
|
||||
-- remote does not support renaming
|
||||
Right Nothing -> fallbackdelete
|
||||
where
|
||||
fallbackdelete = performUnexport r db [ek] src
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue