mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-02 22:33:05 +00:00
Wrap everything in a try-except… If you read this, consider rewriting in Rust!
This commit is contained in:
parent
91f0effd3a
commit
26a8785d7a
1 changed files with 7 additions and 4 deletions
|
@ -25,10 +25,13 @@ def backup(backup_prefix):
|
|||
now = datetime.now().strftime("%d_%m_%Y_%H_%M_%S")
|
||||
dest = db_bk_dir / f"{backup_prefix}_{now}.sqlite"
|
||||
|
||||
status = subprocess.run(["sqlite3", db_path, f".backup {dest}"], check=False).returncode
|
||||
if status == 0:
|
||||
flash(f"Created a database backup at the path {dest}", "success")
|
||||
else:
|
||||
try:
|
||||
status = subprocess.run(["sqlite3", db_path, f".backup {dest}"], check=False).returncode
|
||||
if status == 0:
|
||||
flash(f"Created a database backup at the path {dest}", "success")
|
||||
else:
|
||||
flash("Failed to create a database backup!", "danger")
|
||||
except:
|
||||
flash("Failed to create a database backup! Make sure that `sqlite3` is installed on your system!", "danger")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue