avoid type error by throwing costum exception