fix in handling exceptions in cmds
This commit is contained in:
parent
d8ce7c8bc2
commit
84f4ecf5a1
@ -33,9 +33,11 @@ class CmdInterpreter(cmd.Cmd):
|
|||||||
|
|
||||||
def onecmd(self, line):
|
def onecmd(self, line):
|
||||||
try:
|
try:
|
||||||
return self.onecmd(line)
|
return super().onecmd(line)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = 'Caught exception in cmd "{0}": {1!s}'.format(line, e)
|
msg = 'Caught exception in cmd "{0}": {1!s}'.format(line, e)
|
||||||
|
self.__println(msg)
|
||||||
|
self.logger.error(msg)
|
||||||
|
|
||||||
def __print(self, text):
|
def __print(self, text):
|
||||||
self.stdout.write(text)
|
self.stdout.write(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user