diff options
author | Henrique <typoon@gmail.com> | 2019-11-13 09:26:37 -0500 |
---|---|---|
committer | Henrique <typoon@gmail.com> | 2019-11-13 09:26:37 -0500 |
commit | cf6839a9d9e09e2bcb7fcc1acd3ecafa82415748 (patch) | |
tree | b5e9738cff8a36c855843e3c953d62c792c2f2c9 | |
parent | d90262ad35b25a7a4ec0e01a2dd4d4c813729030 (diff) | |
download | mitmproxy-cf6839a9d9e09e2bcb7fcc1acd3ecafa82415748.tar.gz mitmproxy-cf6839a9d9e09e2bcb7fcc1acd3ecafa82415748.tar.bz2 mitmproxy-cf6839a9d9e09e2bcb7fcc1acd3ecafa82415748.zip |
Removed an exception handle that can't happen anymore due to the new
lexer
-rw-r--r-- | mitmproxy/command.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py index 3da3a298..d9ba4055 100644 --- a/mitmproxy/command.py +++ b/mitmproxy/command.py @@ -165,8 +165,9 @@ class CommandManager(mitmproxy.types._CommandBase): if not t: break parts.append(t) + if not parts: - parts = [""] + parts = [] elif cmdstr.endswith(" "): parts.append("") @@ -233,20 +234,14 @@ class CommandManager(mitmproxy.types._CommandBase): """ Execute a command string. May raise CommandError. """ - if cmdstr == '': - raise exceptions.CommandError("Invalid command: %s" % cmdstr) - - try: - parts, _ = self.parse_partial(cmdstr) - except ValueError as e: - raise exceptions.CommandError("Command error: %s" % e) - if len(parts) == 0: - raise exceptions.CommandError("Invalid command: %s" % cmdstr) - + parts, _ = self.parse_partial(cmdstr) params = [] for p in parts: params.append(p.value) + if len(parts) == 0: + raise exceptions.CommandError("Invalid command: %s" % cmdstr) + return self.call_strings(params[0], params[1:]) def dump(self, out=sys.stdout) -> None: |