From 9233530df5cb2fc5306c729b51ac8a27865c6193 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 18 Oct 2019 11:19:48 +0200 Subject: [PATCH] added default message to NotActiveTable --- pype/ftrack/lib/custom_db_connector.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pype/ftrack/lib/custom_db_connector.py b/pype/ftrack/lib/custom_db_connector.py index e32e62948a..931b46fc00 100644 --- a/pype/ftrack/lib/custom_db_connector.py +++ b/pype/ftrack/lib/custom_db_connector.py @@ -20,7 +20,13 @@ import requests import pymongo from pymongo.client_session import ClientSession -class NotActiveTable(Exception): pass +class NotActiveTable(Exception): + def __init__(self, *args, **kwargs): + msg = "Active table is not set. (This is bug)" + if not (args or kwargs): + args = (default_message,) + super().__init__(*args, **kwargs) + def auto_reconnect(func): """Handling auto reconnect in 3 retry times""" @@ -35,12 +41,11 @@ def auto_reconnect(func): time.sleep(0.1) else: raise - return decorated def check_active_table(func): - """Handling auto reconnect in 3 retry times""" + """Check if DbConnector has active table before db method is called""" @functools.wraps(func) def decorated(obj, *args, **kwargs): if not obj.active_table: