mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-04 22:40:30 +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")
|
now = datetime.now().strftime("%d_%m_%Y_%H_%M_%S")
|
||||||
dest = db_bk_dir / f"{backup_prefix}_{now}.sqlite"
|
dest = db_bk_dir / f"{backup_prefix}_{now}.sqlite"
|
||||||
|
|
||||||
status = subprocess.run(["sqlite3", db_path, f".backup {dest}"], check=False).returncode
|
try:
|
||||||
if status == 0:
|
status = subprocess.run(["sqlite3", db_path, f".backup {dest}"], check=False).returncode
|
||||||
flash(f"Created a database backup at the path {dest}", "success")
|
if status == 0:
|
||||||
else:
|
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")
|
flash("Failed to create a database backup! Make sure that `sqlite3` is installed on your system!", "danger")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue