revise to return last error on retry failure