I think it's better catching it in one place because the AttributeError can appear in both of them.

The custom class would be handy, but where to pu them? I would like to have each exception in different file that you must import separately, I would prefer some centralised file containing all exceptions.