use type contraints instead of throwing runtime error