Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dnsviz/dnsviz.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCasey Deccio <casey@deccio.net>2015-10-14 00:17:06 +0300
committerCasey Deccio <casey@deccio.net>2015-10-14 00:17:06 +0300
commit6b18b73488607b322c151187eb085b0c804318e5 (patch)
tree8a93e56b70cb964411b76899090717d9c1bdb2e8 /bin
parent025fd8a72a8b5ecc93d71c19e0fdbb8ba8ab20d5 (diff)
Make command detection more robust
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dnsviz7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/dnsviz b/bin/dnsviz
index 993043c..00fa75b 100755
--- a/bin/dnsviz
+++ b/bin/dnsviz
@@ -56,6 +56,13 @@ def main():
try:
mod = importlib.import_module('dnsviz.commands.%s' % command)
except ImportError:
+ # if there are more than two frames in the stack trace,
+ # then the command was legit, but there was an ImportError
+ # raised while running that command.
+ exc_frame = sys.exc_info()[2]
+ if exc_frame.tb_next.tb_next is not None:
+ raise
+
usage('Invalid command: %s' % command)
sys.exit(1)