]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
nvmetcli: improve error reporting
authorChristoph Hellwig <hch@lst.de>
Fri, 25 Mar 2016 13:59:01 +0000 (14:59 +0100)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Mar 2016 15:01:51 +0000 (16:01 +0100)
Report a nice error message in red instead of a python backtrace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
nvmetcli

index 95b36c96edf16266dc80cad959a466d497ea7a30..fa2623b9325c18e7dab8290836a3eadca3cc5885 100755 (executable)
--- 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__":