I could not get what is wrong with the code ? when I execute nothing happens. I am expecting my custom error message.
def testing():
try:
raise Exception('My error!')
except:
pass
testing()
I could not get what is wrong with the code ? when I execute nothing happens. I am expecting my custom error message.
def testing():
try:
raise Exception('My error!')
except:
pass
testing()
You are successfully raising an error. And the try/catch statements sees it, and goes to
catch
as you have raised an error.To fully customize errors you can declare them as so:
results in