♻️ 将退出码移到 logging 项目中

This commit is contained in:
Liang Ding 2023-03-18 18:10:06 +08:00
parent e99b7fd588
commit 2601605953
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
13 changed files with 29 additions and 39 deletions

View file

@ -1148,7 +1148,7 @@ func beginTx() (tx *sql.Tx, err error) {
if tx, err = db.Begin(); nil != err {
logging.LogErrorf("begin tx failed: %s\n %s", err, logging.ShortStack())
if strings.Contains(err.Error(), "database is locked") {
os.Exit(util.ExitCodeReadOnlyDatabase)
os.Exit(logging.ExitCodeReadOnlyDatabase)
}
}
return
@ -1158,7 +1158,7 @@ func beginHistoryTx() (tx *sql.Tx, err error) {
if tx, err = historyDB.Begin(); nil != err {
logging.LogErrorf("begin history tx failed: %s\n %s", err, logging.ShortStack())
if strings.Contains(err.Error(), "database is locked") {
os.Exit(util.ExitCodeReadOnlyDatabase)
os.Exit(logging.ExitCodeReadOnlyDatabase)
}
}
return