I have a lot of getter functions like this:
get_property_a(default=None):
try:
self.data.get("field_1")[0].get("a")
except Exception as e:
return default
get_property_b(default=None):
try:
self.data.get("field_2")[0].get("b")
except Exception as e:
return default
...
Is there a way to not wrapping all the getters in try/except? It would be nice if it is some kind of annotation like this:
@silent_exec(default=None)
def get_property_b():
self.data.get("field_2")[0].get("b")
Thanks