@andreorvalho maybe take these error methods out in a separate module?