backups: Handle common errors during borg operations

Closes: #2218.

- When borg can't acquire a lock due to it being busy, any borg operation can
fail. Show a readable message instead of a generic error.

- Also handle errors for archive already existing and archive to be deleted not
existing.

Tests:

- Functional tests for backup app work.

- Creating archive works with proper message. Providing the name of existing
archive shows proper error.

- Deleting archive works with proper message. Open two tabs by clicking on the
delete archive button. Then delete with one and try to delete the it again with
the next one. Proper error message is shown.

- While downloading an archive, delete an archive. Proper error message that
borg is busy is shown.

- Upload archive works. A proper success message is shown.

- Restore backup from archive works. A proper success message is shown.

- Restore backup from file upload works. A proper success message is shown after
upload and after restoration.

- Adding local repository works. A proper success message is shown.

- Adding remote repository works. A proper success message is shown when SSH key
is verified and repository is added.

- Removing repository works. A proper success message is shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2024-12-30 08:34:14 -05:00
1 parent fd1d13f9af
commit e0aef43ece
3 files changed
+95 -36

No files matched your search

+12
View File
@@ -21,3 +21,15 @@ class BorgRepositoryExists(BorgError):
class BorgUnencryptedRepository(BorgError):
"""Attempt to provide password on an unencrypted repository."""
class BorgArchiveExists(BorgError):
"""A archive with the given name already exists in the repository."""
class BorgArchiveDoesNotExist(BorgError):
"""Specified archive does not exist in the repository."""
class BorgBusy(BorgError):
"""Borg could not acquire lock being busy with another operation."""