mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Improve backup decrypt exceptions (#135765)
This commit is contained in:
parent
eb98f110d3
commit
2e189480a5
@ -17,27 +17,36 @@ from securetar import SecureTarError, SecureTarFile, SecureTarReadError
|
|||||||
|
|
||||||
from homeassistant.backup_restore import password_to_key
|
from homeassistant.backup_restore import password_to_key
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.util.json import JsonObjectType, json_loads_object
|
from homeassistant.util.json import JsonObjectType, json_loads_object
|
||||||
|
|
||||||
from .const import BUF_SIZE, LOGGER
|
from .const import BUF_SIZE, LOGGER
|
||||||
from .models import AddonInfo, AgentBackup, Folder
|
from .models import AddonInfo, AgentBackup, Folder
|
||||||
|
|
||||||
|
|
||||||
class DecryptError(Exception):
|
class DecryptError(HomeAssistantError):
|
||||||
"""Error during decryption."""
|
"""Error during decryption."""
|
||||||
|
|
||||||
|
_message = "Unexpected error during decryption."
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedSecureTarVersion(DecryptError):
|
class UnsupportedSecureTarVersion(DecryptError):
|
||||||
"""Unsupported securetar version."""
|
"""Unsupported securetar version."""
|
||||||
|
|
||||||
|
_message = "Unsupported securetar version."
|
||||||
|
|
||||||
|
|
||||||
class IncorrectPassword(DecryptError):
|
class IncorrectPassword(DecryptError):
|
||||||
"""Invalid password or corrupted backup."""
|
"""Invalid password or corrupted backup."""
|
||||||
|
|
||||||
|
_message = "Invalid password or corrupted backup."
|
||||||
|
|
||||||
|
|
||||||
class BackupEmpty(DecryptError):
|
class BackupEmpty(DecryptError):
|
||||||
"""No tar files found in the backup."""
|
"""No tar files found in the backup."""
|
||||||
|
|
||||||
|
_message = "No tar files found in the backup."
|
||||||
|
|
||||||
|
|
||||||
def make_backup_dir(path: Path) -> None:
|
def make_backup_dir(path: Path) -> None:
|
||||||
"""Create a backup directory if it does not exist."""
|
"""Create a backup directory if it does not exist."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user