Skip to content

Commit

Permalink
scripts/qmp-shell: Remove too-broad-exception
Browse files Browse the repository at this point in the history
We are only anticipating QMPShellErrors here, for syntax we weren't able
to understand. Other errors, if any, should be allowed to percolate
upwards.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-36-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
  • Loading branch information
jnsnow committed Jun 18, 2021
1 parent c83055e commit 26d3ce9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/qmp/qmp-shell
Expand Up @@ -291,10 +291,13 @@ class QMPShell(qmp.QEMUMonitorProtocol):
def _execute_cmd(self, cmdline: str) -> bool:
try:
qmpcmd = self.__build_cmd(cmdline)
except Exception as err:
print('Error while parsing command line: %s' % err)
print('command format: <command-name> ', end=' ')
print('[arg-name1=arg1] ... [arg-nameN=argN]')
except QMPShellError as err:
print(
f"Error while parsing command line: {err!s}\n"
"command format: <command-name> "
"[arg-name1=arg1] ... [arg-nameN=argN",
file=sys.stderr
)
return True
# For transaction mode, we may have just cached the action:
if qmpcmd is None:
Expand Down

0 comments on commit 26d3ce9

Please sign in to comment.