try:
# 主表,=错误信息
data = {'is',66}
# 提交事务
ms.commit()
except Exception as e:
# 回滚事务
ms.rollback()
my.rollback()
print("出错了")
# 打印异常
traceback.print_exc()
# 获得异常信息,单引号转双引号,保存错误信息
err = traceback.format_exc()
err = err.replace("'", "\"")
Db.updates(my, "wb_synchronization", {'state': 3, 'remark': format(str(err))}, f"id={data['id']}")
# 提交事务
my.commit()
08-27
07-13