Devserver: save traceback in exception file for better debugging.

This CL saves traceback msg into exception file when staging for well
detect where the real error happens.

BUG=chromium:700201
TEST=Ran local devserver & raise error & see whether traceback is
properly raised.

Change-Id: Id71a7e1bf3e59c7ec00505edfabae96f1f501e31
Reviewed-on: https://chromium-review.googlesource.com/452806
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/build_artifact.py b/build_artifact.py
index 8515f39..2388d5a 100755
--- a/build_artifact.py
+++ b/build_artifact.py
@@ -14,6 +14,7 @@
 import re
 import shutil
 import subprocess
+import traceback
 
 import artifact_info
 import common_util
@@ -255,13 +256,13 @@
       os.remove(self.exception_file_path)
 
   def _SaveException(self, e):
-    """Save the exception to a file for downloader.IsStaged to retrieve.
+    """Save the exception and traceback to a file for downloader.IsStaged.
 
     Args:
       e: Exception object to be saved.
     """
     with open(self.exception_file_path, 'w') as f:
-      pickle.dump(e, f)
+      pickle.dump('%s\n%s' % (e, str(traceback.format_exc())), f)
 
   def GetException(self):
     """Retrieve any exception that was raised in Process method.