diff --git a/weaviate/backup/backup.py b/weaviate/backup/backup.py index 857aee6ee..c5a12d70b 100644 --- a/weaviate/backup/backup.py +++ b/weaviate/backup/backup.py @@ -46,6 +46,7 @@ class BackupStatus(str, Enum): class BackupStatusReturn(BaseModel): """Return type of the backup status methods.""" + error: Optional[str] = Field(default=None) status: BackupStatus path: str @@ -139,7 +140,9 @@ def create( if status.status == BackupStatus.SUCCESS: break if status.status == BackupStatus.FAILED: - raise BackupFailedException(f"Backup failed: {create_status}") + raise BackupFailedException( + f"Backup failed: {create_status} with error: {status.error}" + ) sleep(1) return BackupReturn(**create_status) @@ -249,7 +252,9 @@ def restore( if status.status == BackupStatus.SUCCESS: break if status.status == BackupStatus.FAILED: - raise BackupFailedException(f"Backup restore failed: {restore_status}") + raise BackupFailedException( + f"Backup restore failed: {restore_status} with error: {status.error}" + ) sleep(1) return BackupReturn(**restore_status) diff --git a/weaviate/collections/backups.py b/weaviate/collections/backups.py index 85f13cc0e..c3ceec551 100644 --- a/weaviate/collections/backups.py +++ b/weaviate/collections/backups.py @@ -41,7 +41,7 @@ def create( One of the arguments have a wrong type. """ create = self._backup.create(backup_id, backend, [self._name], None, wait_for_completion) - return BackupStatusReturn(status=create.status, path=create.path) + return BackupStatusReturn(error=create.error, status=create.status, path=create.path) def restore( self, backup_id: str, backend: BackupStorage, wait_for_completion: bool = False @@ -70,7 +70,7 @@ def restore( If the backup failed. """ restore = self._backup.restore(backup_id, backend, [self._name], None, wait_for_completion) - return BackupStatusReturn(status=restore.status, path=restore.path) + return BackupStatusReturn(error=restore.error, status=restore.status, path=restore.path) def get_create_status(self, backup_id: str, backend: BackupStorage) -> BackupStatusReturn: """Check if a started backup job has completed.