Closed InbarShirizly closed 4 years ago
there should not be more that 1 try/except per function. If there is more that 1 try/except then the function needs to be refector into many smaller functions
` try: connection = pymysql.connect(host='localhost', user=conf.USER_NAME, password=conf.PASSWORD) except pymysql.err.OperationalError as err: logger_DB.error(conf.CONNECTION_ERROR) exit() else: Create a cursor object try: cursor_instance = connection.cursor() except pymysql.err.OperationalError: logger_DB.error(conf.SERVER_ERROR) exit()`
` try: connection = pymysql.connect(host='localhost', user=conf.USER_NAME, password=conf.PASSWORD) except pymysql.err.OperationalError as err: logger_DB.error(conf.CONNECTION_ERROR) exit() else:
try: cursor_instance = connection.cursor() except pymysql.err.OperationalError: logger_DB.error(conf.SERVER_ERROR) exit()`
In which circumstances we get this error @nirbarazida?
there should not be more that 1 try/except per function. If there is more that 1 try/except then the function needs to be refector into many smaller functions