mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-08 10:29:30 +00:00
Harmonize folder and add-on backup error handling (#5885)
* Harmonize folder and add-on backup error handling Align add-on and folder backup error handling in that in both cases errors are recorded on the respective backup Jobs, but not raised to the caller. This allows the backup to complete successfully even if some add-ons or folders fail to back up. Along with this, also record errors in the per-add-on and per-folder backup jobs, as well as the add-on and folder root job. And finally, align the exception handling to only catch expected exceptions for add-ons too. * Fix pytest
This commit is contained in:
@@ -372,7 +372,9 @@ async def test_api_backup_errors(
|
||||
|
||||
assert coresys.jobs.jobs == []
|
||||
|
||||
with patch.object(Addon, "backup", side_effect=AddonsError("Backup error")):
|
||||
with patch.object(
|
||||
Addon, "backup", side_effect=(err := AddonsError("Backup error"))
|
||||
):
|
||||
resp = await api_client.post(
|
||||
f"/backups/new/{backup_type}",
|
||||
json={"name": f"{backup_type} backup"} | options,
|
||||
@@ -397,7 +399,7 @@ async def test_api_backup_errors(
|
||||
assert job["child_jobs"][1]["child_jobs"][0]["errors"] == [
|
||||
{
|
||||
"type": "BackupError",
|
||||
"message": "Can't create backup for local_ssh",
|
||||
"message": str(err),
|
||||
"stage": None,
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user