[android] Improve reverse forwarder error handling

Tell the user if they are trying to use the reverse ADB forwarder
without having first built the requisite host_forwarder tool.

NOTRY=true


Review URL: https://chromiumcodereview.appspot.com/12640006

git-svn-id: http://src.chromium.org/svn/trunk/src/build@187033 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
skyostil@chromium.org 2013-03-08 20:29:16 +00:00
Родитель 2be1efb1a7
Коммит cbde956b1f
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -88,8 +88,14 @@ class Forwarder(object):
'Failed to start device forwarder:\n%s' % '\n'.join(output))
for redirection_command in redirection_commands:
(exit_code, output) = cmd_helper.GetCmdStatusAndOutput(
[self._host_forwarder_path, redirection_command])
try:
(exit_code, output) = cmd_helper.GetCmdStatusAndOutput(
[self._host_forwarder_path, redirection_command])
except OSError as e:
if e.errno == 2:
raise Exception('Unable to start host forwarder. Make sure you have '
'built host_forwarder.')
else: raise
if exit_code != 0:
raise Exception('%s exited with %d:\n%s' % (
self._host_forwarder_path, exit_code, '\n'.join(output)))