Minor thingy
authorepage <eopage@byu.net>
Wed, 18 Nov 2009 00:22:02 +0000 (00:22 +0000)
committerepage <eopage@byu.net>
Wed, 18 Nov 2009 00:22:02 +0000 (00:22 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@573 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/gtk_toolbox.py

index 575da00..7112030 100644 (file)
@@ -284,6 +284,22 @@ def threaded_stage(target, thread_factory = threading.Thread):
        return queue_sink(messages)
 
 
+def log_exception(logger):
+
+       def log_exception_decorator(func):
+
+               @functools.wraps(func)
+               def wrapper(*args, **kwds):
+                       try:
+                               return func(*args, **kwds)
+                       except Exception:
+                               logger.exception(func.__name__)
+
+               return wrapper
+
+       return log_exception_decorator
+
+
 class LoginWindow(object):
 
        def __init__(self, widgetTree):