Eliminate exceptions from get_type_arity and get_const_type