Refine error codes throughout the upgrader so we can better detect at what stage updates fail.

see #22704.


git-svn-id: https://develop.svn.wordpress.org/trunk@25763 602fd350-edb4-49c9-b593-d223f7449a82