Add error throwing to api methods