diff options
Diffstat (limited to 'voctocore/lib/controlserver.py')
-rw-r--r-- | voctocore/lib/controlserver.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py index 2b96152..79aa617 100644 --- a/voctocore/lib/controlserver.py +++ b/voctocore/lib/controlserver.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -import socket, logging +import socket, logging, traceback from gi.repository import GObject from lib.commands import ControlServerCommands @@ -90,15 +90,23 @@ class ControlServer(): return False, 'unknown command %s' % command - # fetch the function-pointer - f = getattr(self.commands, command) + try: + # fetch the function-pointer + f = getattr(self.commands, command) - # call the function - ret = f(*args) + # call the function + ret = f(*args) - # if it returned an iterable, probably (Success, Message), pass that on - if hasattr(ret, '__iter__'): - return ret - else: - # otherwise construct a tuple - return (ret, None) + # if it returned an iterable, probably (Success, Message), pass that on + if hasattr(ret, '__iter__'): + return ret + else: + # otherwise construct a tuple + return (ret, None) + + except Exception as e: + self.log.error("Trapped Exception in Remote-Communication: %s", e) + traceback.print_exc() + + # In case of an Exception, return that + return False, str(e) |