[autotest] Make json_rpc raise meaningful exceptions

Add some dynamic suite exceptions to client/common_lib/error.py so
that different parts of the system can all reference them.  Then,
enable the json_rpc code to detect these exceptions coming back
over the wire, re-instantiate them on the client side, and raise
them.

BUG=chromium-os:30279
TEST=unit
TEST=use atest suite create to try to create a suite for a build that doesn't exist
TEST=use atest suite create to try to run a suite that doesn't exist

Change-Id: I1b6d56a7e1bdb63cc893a07581efc8decc0407f4
Reviewed-on: https://gerrit.chromium.org/gerrit/22250
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Chris Masone <cmasone@chromium.org>
diff --git a/server/cros/dynamic_suite_unittest.py b/server/cros/dynamic_suite_unittest.py
index 4553d28..2986866 100755
--- a/server/cros/dynamic_suite_unittest.py
+++ b/server/cros/dynamic_suite_unittest.py
@@ -14,7 +14,8 @@
 import time
 import unittest
 
-from autotest_lib.client.common_lib import base_job, control_data, global_config
+from autotest_lib.client.common_lib import base_job, control_data, error
+from autotest_lib.client.common_lib import global_config
 from autotest_lib.frontend.afe.json_rpc import proxy
 from autotest_lib.server.cros import control_file_getter, dynamic_suite
 from autotest_lib.server import frontend
@@ -73,7 +74,7 @@
     def testVetReimageAndRunBuildArgFail(self):
         """Should fail verification because |build| arg is bad."""
         self._DARGS['build'] = None
-        self.assertRaises(dynamic_suite.SuiteArgumentException,
+        self.assertRaises(error.SuiteArgumentException,
                           dynamic_suite._vet_reimage_and_run_args,
                           **self._DARGS)
 
@@ -81,7 +82,7 @@
     def testVetReimageAndRunBoardArgFail(self):
         """Should fail verification because |board| arg is bad."""
         self._DARGS['board'] = None
-        self.assertRaises(dynamic_suite.SuiteArgumentException,
+        self.assertRaises(error.SuiteArgumentException,
                           dynamic_suite._vet_reimage_and_run_args,
                           **self._DARGS)
 
@@ -89,7 +90,7 @@
     def testVetReimageAndRunNameArgFail(self):
         """Should fail verification because |name| arg is bad."""
         self._DARGS['name'] = None
-        self.assertRaises(dynamic_suite.SuiteArgumentException,
+        self.assertRaises(error.SuiteArgumentException,
                           dynamic_suite._vet_reimage_and_run_args,
                           **self._DARGS)
 
@@ -97,7 +98,7 @@
     def testVetReimageAndRunJobArgFail(self):
         """Should fail verification because |job| arg is bad."""
         self._DARGS['job'] = None
-        self.assertRaises(dynamic_suite.SuiteArgumentException,
+        self.assertRaises(error.SuiteArgumentException,
                           dynamic_suite._vet_reimage_and_run_args,
                           **self._DARGS)