From 7aace5d2aad368afd5b4c6bdc24520623bb0a186 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Fri, 25 Mar 2016 14:59:01 +0100
Subject: [PATCH] nvmetcli: improve error reporting

Report a nice error message in red instead of a python backtrace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 nvmetcli | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/nvmetcli b/nvmetcli
index 95b36c9..fa2623b 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -229,13 +229,17 @@ def main():
         funcs[sys.argv[1]](savefile)
         return
 
-    shell = configshell.shell.ConfigShell('~/.nvmetcli')
-    UIRootNode(shell)
+    try:
+        shell = configshell.shell.ConfigShell('~/.nvmetcli')
+        UIRootNode(shell)
+    except Exception as msg:
+         shell.log.error(str(msg))
+         return
 
     while not shell._exit:
         try:
             shell.run_interactive()
-        except configshell.ExecutionError as msg:
+        except Exception as msg:
             shell.log.error(str(msg))
 
 if __name__ == "__main__":
-- 
GitLab