Closed Jaymon closed 4 years ago
There are times when I get errors in properties, something like:
class Foo(object): @property def bar(self): return self.get_bar() def get_bar(self): raise AttributeError()
Properties swallow the error so I'll modify bar to catch the error so I can see what is happening:
bar
@property def bar(self): try return self.get_bar() catch Exception as e: pout.v(e) raise
It would be cool if I could do this:
@property def bar(self): with pout.e(): return self.get_bar()
and pout.e() will just print any exceptions and then raise them again.
pout.e()
There are times when I get errors in properties, something like:
Properties swallow the error so I'll modify
bar
to catch the error so I can see what is happening:It would be cool if I could do this:
and
pout.e()
will just print any exceptions and then raise them again.