Refactored db_backup_import.py

This commit is contained in:
CasVT
2025-08-02 17:07:45 +02:00
parent 09b152fabc
commit 783a5664d5
4 changed files with 119 additions and 80 deletions

View File

@@ -150,11 +150,12 @@ class NewAccountsNotAllowed(MindException):
class InvalidDatabaseFile(MindException):
"The uploaded database file is invalid or not supported"
def __init__(self, filepath_db: str) -> None:
def __init__(self, filepath_db: str, reason: str) -> None:
self.filepath_db = filepath_db
self.reason = reason
LOGGER.warning(
"The given database file is invalid: %s",
filepath_db
"The given database file is invalid: %s (reason=%s)",
filepath_db, reason
)
return
@@ -164,7 +165,8 @@ class InvalidDatabaseFile(MindException):
'code': 400,
'error': self.__class__.__name__,
'result': {
'filepath_db': self.filepath_db
'filepath_db': self.filepath_db,
'reason': self.reason
}
}