I have the following code, if the try catch statement executed successfully then I write in my database model success = True
and if the code Excepts then I want to write success = False
. In purpose I raise the exception in order to test my except statement. The code goes successfully in the except statement because I get the print, but it does not write in my database.
try:
...do some work...
models.SyncRun(success=True).save()
raise Exception
except Exception as e:
print("in")
models.SuncRun(success=False).save()
raise Exception
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…