exception not thrown properly