I have a function called onError(). When it is ran, it prints "There was an error"
I want this function to run whenever an error occurs, for example, if I raise NameError, the function runs.
Here is my code
def onError():
print("There was an error")
raise NameError
I know that try and except exist, but I want a way to do it without them.