devserver: not raise error in get_au_status

This CL changes 'raising error' to 'returning a json object which includes
IOError msg' when track log of auto-update cannot be opened.

BUG=chromium:667462
TEST=Ran auto_update locally.

Change-Id: I3dbd1f3fa37a5f7d7cc21a6c296cc9e326c2052e
Reviewed-on: https://chromium-review.googlesource.com/414286
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/devserver.py b/devserver.py
index 95b498b..4d50fd6 100755
--- a/devserver.py
+++ b/devserver.py
@@ -893,26 +893,22 @@
       if result.startswith(cros_update_progress.ERROR_TAG):
         result_dict['detailed_error_msg'] = result[len(
             cros_update_progress.ERROR_TAG):]
-        return json.dumps(result_dict)
-
-      if result == cros_update_progress.FINISHED:
+      elif result == cros_update_progress.FINISHED:
         result_dict['finished'] = True
         result_dict['status'] = result
-        return json.dumps(result_dict)
-
-      if not cros_update_progress.IsProcessAlive(pid):
+      elif not cros_update_progress.IsProcessAlive(pid):
         result_dict['detailed_error_msg'] = (
             'Cros_update process terminated midway due to unknown reason. '
             'Last update status was %s' % result)
-        return json.dumps(result_dict)
-
-      result_dict['status'] = result
-      return json.dumps(result_dict)
-    except IOError:
-      if pid:
+      else:
+        result_dict['status'] = result
+    except IOError as e:
+      if pid and cros_update_progress.IsProcessAlive(pid):
         os.killpg(int(pid), signal.SIGKILL)
 
-      raise
+      result_dict['detailed_error_msg'] = str(e)
+
+    return json.dumps(result_dict)
 
   @cherrypy.expose
   def handler_cleanup(self, **kwargs):