Fixed error handling when an upload error occurs.