Instead of this:
def function():
try:
0/0
except Exception: # i know this is bad error handling but its just an example
print("Crashed in function")
I want this:
def function():
0/0
# gets called when theres an exception
def exception_handler(exc): # exc in some way contains everything about the exception
if exc == something # something that will determine that it occurred inside of function()
print("Crashed in function")
I want this because it's cleaner code and better performance.