Is there a way to shorten the following scenario so i don't have to use an ugly nested try except statement?
class Error(Exception):
    def __init__(self):
        print("That did not work")
try:
    try:
        gblgbl
    except:
        raise Error
except Error:
    pass
What i want can be described as following pseudo code:
Try something:
    something
if something went wrong:
    raise Error
catch Error:
    what to do if error occours
I don't want to raise the error if the try statement succeeds, however if i raise an exception in the exception statement like this:
try:
    gblgbl
except:
    raise Error
except Error:
    pass
it can't be caught with an other except, since there is already an except that caught the python exception and the interpreter throws a SyntaxError.
Am i missing something obvious?
I'm aware that you probably would never use this in an actual program, but i'm curious about the theory.
 
     
     
    