I want to catch an exception thrown from imported module and raise it to fail the job giving the same exception.
for example,
------a.py----------
def check(a, b):
try:
# Check something
except Exception as e:
raise Exception(f"Exception is {e}")
-------b.py-------
import a
def function():
try:
res = a.check()
except Exception as e:
raise e
In the above example if check function raises an error, I want to catch it in b.py file and raise it thus stopping the execution. I am able to get the exception but the execution does not stop, it continues running b.py file. I even tried sys.exit(1)
after catching the exception.
Any suggestions?