From 031632245e147e4532b252f91e31631570aa0fd3 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Mon, 11 May 2015 00:32:50 +0200 Subject: a rudimentary audio pipeline --- voctocore/lib/controlserver.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'voctocore/lib/controlserver.py') 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) -- cgit v1.2.3