getattr only catches AttributeError. This should catch any exceptions. I think we have a `safe_getattr` elsewhere, which could be used.