I have following code sample,
class Outer:
class InnerException(Exception): pass
def raise_inner(self):
raise Outer.InnerException()
def call_raise(self):
try:
self.raise_inner()
except Outer.InnerException as e:
print "Handle me"
Outer().call_raise()
What I wish to do is instead of using Outer.InnerException
just use InnerException
inside the Outer class, in short something like this
class Outer:
class InnerException(Exception): pass
#InnerException = Outer.InnerException .. something like this, create some alias
def raise_inner(self):
raise InnerException()
def call_raise(self):
try:
self.raise_inner()
except InnerException as e:
print "Handle me"
Outer().call_raise()