build_lib: fix an exception catch problem
router is renamed to router_lib, so the exceptions belong to the
module (router_lib) and not the object itself.
The error message happend was:
Traceback (most recent call last):
File "/b/s/w/ir/k/chromiumos_workspace/chromite/bin/build_api", line 170, in <module>
DoMain()
File "/b/s/w/ir/k/chromiumos_workspace/chromite/bin/build_api", line 166, in DoMain
commandline.ScriptWrapperMain(FindTarget)
File "/b/s/w/ir/k/chromiumos_workspace/chromite/lib/commandline.py", line 959, in ScriptWrapperMain
ret = target(argv[1:])
File "/b/s/w/ir/k/chromiumos_workspace/chromite/scripts/build_api.py", line 75, in main
except router.Error as e:
AttributeError: 'Router' object has no attribute 'Error'
BUG=none
TEST=precq
Change-Id: If54960d55536b19be9fea2203a62cc10053ff3f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1674215
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/build_api.py b/scripts/build_api.py
index b2e27c9..44c3218 100644
--- a/scripts/build_api.py
+++ b/scripts/build_api.py
@@ -72,6 +72,7 @@
try:
return router.Route(opts.service, opts.method, opts.input_json,
opts.output_json)
- except router.Error as e:
- # Handle router.Error derivatives nicely, but let anything else bubble up.
+ except router_lib.Error as e:
+ # Handle router_lib.Error derivatives nicely, but let anything else bubble
+ # up.
cros_build_lib.Die(e.message)