Just print the traceback and move on. This gives the user time to
exit gracefully (saving playlists etc.).
"""
import Queue as queue
+import sys
import textwrap
+import traceback
class CommandExit (Exception):
class Failure (CommandExit):
pass
+class UncaughtException (Failure):
+ def __init__(self, exception):
+ super(UncaughtException, self).__init__(exception)
+ self.exception = exception
+ self.exc_string = traceback.format_exc()
+ sys.exc_clear()
+
class Command (object):
"""One-line command description here.
outqueue.put(str(e))
outqueue.put(e)
return 1
+ except Exception, e:
+ x = UncaughtException(e)
+ outqueue.put(x.exc_string)
+ outqueue.put(x)
+ return 1
outqueue.put(e)
return 0