Improve the standard error message in the lab if an update fails.

Produce a more meaningful (but still generic) error message in the lab
if an update fails to apply.

Take 2!

BUG=chromium:246779
TEST=New unittest + trybots

Change-Id: I9f481e9c4143d66de1d7a91f1436e9d1155aa8ab
Reviewed-on: https://chromium-review.googlesource.com/180255
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index af2dae3..d16ab19 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -222,9 +222,26 @@
         logging.info('Triggering update via: %s', autoupdate_cmd)
         try:
             self._run(autoupdate_cmd)
-        except error.AutoservRunError, e:
-            raise RootFSUpdateError('Update triggering failed on %s: %s' %
-                                    (self.host.hostname, str(e)))
+        except (error.AutoservSshPermissionDeniedError,
+                error.AutoservSSHTimeout) as e:
+            raise RootFSUpdateError('SSH on %s is seeing %s' %
+                                    (self.host.hostname, type(e).__name__))
+        except error.AutoservRunError as e:
+
+            # Check if the exit code is 255, if so it's probably a generic
+            # SSH error.
+            result = e.args[1]
+            if result.exit_status == 255:
+              raise RootFSUpdateError('SSH on %s is seeing a generic error.' %
+                                      self.host.hostname)
+
+            # We have ruled out all SSH cases, the error code is from
+            # update_engine_client, though we still don't know why.
+            raise RootFSUpdateError(
+                    'devserver unreachable, payload unavailable, '
+                    'or AU bug (unlikely) on %s: %s' %
+                    (self.host.hostname, type(e).__name__))
+
 
     def _verify_update_completed(self):
         """Verifies that an update has completed.