aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/types.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-12-19 18:01:39 +1300
committerAldo Cortesi <aldo@corte.si>2017-12-20 08:21:48 +1300
commit3341edc9fa8e70306e91cf911e4b2b19ef60ba84 (patch)
tree6130b0c1053895f7eea6a1cc07252dbaee94b157 /mitmproxy/types.py
parentd98fc4f03a88751944c0ae08ee2ac3e743f92952 (diff)
downloadmitmproxy-3341edc9fa8e70306e91cf911e4b2b19ef60ba84.tar.gz
mitmproxy-3341edc9fa8e70306e91cf911e4b2b19ef60ba84.tar.bz2
mitmproxy-3341edc9fa8e70306e91cf911e4b2b19ef60ba84.zip
commander: highlight commands
Step 1 of the fancification of commander.
Diffstat (limited to 'mitmproxy/types.py')
-rw-r--r--mitmproxy/types.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mitmproxy/types.py b/mitmproxy/types.py
index 36f33943..bdbd3924 100644
--- a/mitmproxy/types.py
+++ b/mitmproxy/types.py
@@ -318,7 +318,10 @@ class _FlowType(_BaseFlowType):
display = "flow"
def parse(self, manager: _CommandBase, t: type, s: str) -> flow.Flow:
- flows = manager.call_args("view.resolve", [s])
+ try:
+ flows = manager.call_args("view.resolve", [s])
+ except exceptions.CommandError as e:
+ raise exceptions.TypeError from e
if len(flows) != 1:
raise exceptions.TypeError(
"Command requires one flow, specification matched %s." % len(flows)
@@ -334,7 +337,10 @@ class _FlowsType(_BaseFlowType):
display = "[flow]"
def parse(self, manager: _CommandBase, t: type, s: str) -> typing.Sequence[flow.Flow]:
- return manager.call_args("view.resolve", [s])
+ try:
+ return manager.call_args("view.resolve", [s])
+ except exceptions.CommandError as e:
+ raise exceptions.TypeError from e
def is_valid(self, manager: _CommandBase, typ: typing.Any, val: typing.Any) -> bool:
try: