Fix typo which prevents builds from failing properly.

If a build fails with an exception, the build is marked as failed. However,
due to a typo, exceptions with no associated message are suppressed by
cbuildbot_background.py. Checking for None explicitly fixes this.

I've also updated cbuildbot.py to check for failing stages explicitly in
case a stage fails without throwing an exception (e.g. a NonHaltingStage).

I've verified that each one of the above changes individually fixes Bug
27723.

BUG=chromium-os:27723
TEST=Verify that build fails with sample failure, and succeeds without it.
Change-Id: I60d35e14cd65a0c4208defd2a264c196905c9a35
Reviewed-on: https://gerrit.chromium.org/gerrit/17979
Reviewed-by: Ryan Cui <rcui@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 7136441..9f857e0 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -391,8 +391,6 @@
           # Kick off task(board) in the background.
           queue.put([board])
 
-    return True
-
 
 class DistributedBuilder(SimpleBuilder):
   """Build class that has special logic to handle distributed builds.
@@ -448,7 +446,8 @@
     """Runs simple builder logic and publishes information to overlays."""
     was_build_successful = False
     try:
-      was_build_successful = super(DistributedBuilder, self).RunStages()
+      super(DistributedBuilder, self).RunStages()
+      was_build_successful = results_lib.Results.BuildSucceededSoFar()
     except SystemExit as ex:
       # If a stage calls sys.exit(0), it's exiting with success, so that means
       # we should mark ourselves as successful.
@@ -458,8 +457,6 @@
     finally:
       self.Publish(was_build_successful)
 
-    return was_build_successful
-
 
 def _ConfirmBuildRoot(buildroot):
   """Confirm with user the inferred buildroot, and mark it as confirmed."""