I want to know the side effects or unknown issues of using try/except block in the below approaches?
Approach 1:
def f1():
try:
# some code here
except Exception as e:
print(str(e))
def f2():
try:
f1()
except Exception as e:
print(str(e))
Approach 2: Same logic as in approach 1 but without try/block in f1()
def f1():
# some code here
def f2():
try:
f1()
except Exception as e:
print(str(e))
Approach 3: Using multiple nested functions
def f1():
# some code here
def f4():
# some code here
def f3():
f4()
# some code here
def f2():
try:
f1()
f3()
except Exception as e:
print(str(e))
Approach 4: Adding multiple try/except in every function
def f1():
try:
# some code here
except Exception as e:
print(str(e))
def f4():
try:
# some code here
except Exception as e:
print(str(e))
def f3():
try:
f4()
# some code here
except Exception as e:
print(str(e))
def f2():
try:
f1()
f3()
except Exception as e:
print(str(e))