+1 for the patch. Recently, one of our customer have tried to upgrade the replica, and, obviously, failed. I don't remember the exact error message, but for him it was not so clear that server is in recovery. Explicitly declaring error is the way to go in my view.
So, I consider this patch useful. Overall, looks good to me. -- Best regards, Maxim Orlov.