throw proper exception types