From 621f4ca23b1a1befacfb71c85255a19db0d260e1 Mon Sep 17 00:00:00 2001 From: PixelSergey Date: Tue, 8 Mar 2016 20:32:56 +0200 Subject: Added a debug decorator, use @debug to nicely print function errors --- helpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helpers.py b/helpers.py index 8485b2a..4c32e24 100755 --- a/helpers.py +++ b/helpers.py @@ -314,3 +314,13 @@ def array_to_list(array): for a in array: return_list += [a] return return_list + + +#debug wrapper +def debug(func): + def wrap(*args, **kwargs): + try: + func(*args, **kwargs) + except: + print(trace()) + return wrap -- cgit v1.2.3