try except in a function python code example
Example 1: how to print error in try except python
try:
# some code
except Exception as e:
print("ERROR : "+str(e))
Example 2: throwing an exception python
raise Exception("message")
try:
# some code
except Exception as e:
print("ERROR : "+str(e))
raise Exception("message")