I have 4 functions-1,2,3,4 in my python module, each function does a insert stmt and I want the subsequent function to be executed only if the prior function ended successfully..
How would I do this?
code.py
def main():
func1()
func2()
func3()
func4()
def func1():
try:
insert into table1
catch:
database.error as e
def func2():
try:
insert into table2
catch:
database.error as e
If you want the subsequent functions to be executed only if the prior function ended successfully, then call them in sequence in one
try .. catchblock.and don’t catch exceptions in the functions.