[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/frontend/afe/json_rpc/proxy.py b/frontend/afe/json_rpc/proxy.py
index b01cc36..718bac3 100644
--- a/frontend/afe/json_rpc/proxy.py
+++ b/frontend/afe/json_rpc/proxy.py
@@ -20,6 +20,7 @@
"""
import urllib2
+from autotest_lib.client.common_lib import error as exceptions
class JSONRPCException(Exception):
pass
@@ -55,6 +56,9 @@
for cls in JSONRPCException.__subclasses__():
if error['name'] == cls.__name__:
return cls(error, error_message)
+ for cls in exceptions.CrosDynamicSuiteException.__subclasses__():
+ if error['name'] == cls.__name__:
+ return cls(error_message)
return JSONRPCException(error_message)
class ServiceProxy(object):