updated error throwing