fix: make database cleanup fail with a non-zero exit (#112)

A caught exception used to end the process with status 0, so callers
treated a failed wipe as success.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Kris K <zhouxiaoka@users.noreply.github.com>
This commit is contained in:
Kris K
2026-09-22 10:31:16 +08:00
committed by GitHub
co-authored by Cursor Agent Kris K
parent de4dee377e
commit 619a0867e4
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -7,7 +7,8 @@
## [未发布] ## [未发布]
_(本周尚无改动)_ ### 修复
- 数据库清理脚本失败时返回退出码 1。之前异常被接住后进程仍以 0 退出,调用方会以为清理已经成功。
## [1.3.1] - 2026-09-21 ## [1.3.1] - 2026-09-21
+1
View File
@@ -51,6 +51,7 @@ def clean_database():
except Exception as e: except Exception as e:
print(f"❌ 清理数据库时发生错误: {e}") print(f"❌ 清理数据库时发生错误: {e}")
db.rollback() db.rollback()
sys.exit(1)
finally: finally:
db.close() db.close()