From fadd2854e507ff1108a55a818ce5412dea45c530 Mon Sep 17 00:00:00 2001 From: Brandon Davis Date: Mon, 22 Aug 2016 21:59:08 -0700 Subject: [PATCH] Fix for remaining comments. - Call function within try/catch - Syntax clean up --- snappass/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/snappass/main.py b/snappass/main.py index 463d8f5..089a364 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -27,14 +27,15 @@ time_conversion = { def check_redis_alive(fn): def inner(*args, **kwargs): try: - redis_client.ping() + if fn.__name__ == 'main': + redis_client.ping() + return fn(*args, **kwargs) except ConnectionError as e: - print(e) - if fn.__name__ == "main": + print('Failed to connect to redis! %s' % e.message) + if fn.__name__ == 'main': sys.exit(0) else: return abort(500) - return fn(*args, **kwargs) return inner