hello,
I want to raise errors in my py scripts then these error catch by into @PYEXCEPTIONTYPE , @PYEXCEPTIONMSG, @PYEXCEPTIONTRACEBACK
What can be the best method ?
a/ to re-raise a error from a try sequence :
these sample can catch 3 types of error : path not found, json not correct, mykey not found ...
def myfunc(path):
result = ''
try:
f_path = open(path)
config = json.load(f_path)
a = config["mykey"]
except:
raise
how can I have it at BASIC level into @PYEXCEPTIONTYPE , @PYEXCEPTIONMSG, @PYEXCEPTIONTRACEBACK
in this case, @PYEXCEPTIONTYPE , @PYEXCEPTIONMSG, @PYEXCEPTIONTRACEBACK are null.
b/ to raise a error from script :
def myfnc(a)
if a < 2:
raise ValueError(f"integer above 1 expected, got {a}")
in this case, @PYEXCEPTIONTYPE , @PYEXCEPTIONMSG, @PYEXCEPTIONTRACEBACK are null.
Thanks
manu
