# Buggy code
def wrapper(self, *args, **kwargs):
    # print('['+self.__host+':'+str(self.__port)+'] '
    #       '>>>>> ['+funcName+']')
    # before = datetime.datetime.now()
    self.transport.open()
    func = getattr(self.client, funcName)
    try:
        res = func(*args, **kwargs)
        return res
    except shared.ttypes.RequestFailed as reqfailure:
        if reqfailure.errorCode == shared.ttypes.ErrorCode.DATABASE:
            print("Database error on server")
            print(str(reqfailure.message))
        elif reqfailure.errorCode == shared.ttypes.ErrorCode.AUTH_DENIED:
            print("Authentication denied")
            print(str(reqfailure.message))
        elif reqfailure.errorCode == shared.ttypes.ErrorCode.UNAUTHORIZED:
            print("Unauthorized to access")
            print(str(reqfailure.message))
        else:
            print("API call error: " + funcName)
            print(str(reqfailure))

    except TProtocolException as ex:
        print("Connection failed to {0}:{1}".format(self.__host, self.__port))
        print("Check if your CodeChecker server is running.")
    except socket.error as serr:
        print("Connection failed to {0}:{1}".format(self.__host, self.__port))
        errCause = os.strerror(serr.errno)
        print(errCause)
        print(str(serr))
        print("Check if your CodeChecker server is running.")
    finally:
        self.transport.close()


# Traceback (IndexError)
[14:00] - 127.0.0.1:55233 -- [Anonymous] POST /Xerces/CodeCheckerService
Traceback (most recent call last):
File "/home/compass/srv/CodeCheckerv6/workspace/install/CodeChecker/lib/python2.7/gencodechecker/codeCheckerDBAccess/codeCheckerDBAccess.py", line 2478, in
process_massStoreRun
result.success = self._handler.massStoreRun(args.run_name, args.version, args.zipfile, args.force)
File "/home/compass/srv/CodeCheckerv6/workspace/install/CodeChecker/lib/python2.7/libcodechecker/profiler.py", line 45, in release_wrapper
res = function(*args, **kwargs)
File "/home/compass/srv/CodeCheckerv6/workspace/install/CodeChecker/lib/python2.7/libcodechecker/server/client_db_access_handler.py", line 2355, in massStor
eRun
store_handler.collect_paths_events(report, file_ids)
File "/home/compass/srv/CodeCheckerv6/workspace/install/CodeChecker/lib/python2.7/libcodechecker/analyze/store_handler.py", line 106, in collect_paths_event
s
file_path = files[event['location']['file']]
IndexError: list index out of range
[14:02] - Session timeout for run 4

# Fixed code
def wrapper(self, *args, **kwargs):
    # print('['+self.__host+':'+str(self.__port)+'] '
    #       '>>>>> ['+funcName+']')
    # before = datetime.datetime.now()
    self.transport.open()
    func = getattr(self.client, funcName)
    try:
        res = func(*args, **kwargs)
        return res
    except shared.ttypes.RequestFailed as reqfailure:
        if reqfailure.errorCode == shared.ttypes.ErrorCode.DATABASE:
            print("Database error on server")
            print(str(reqfailure.message))
        elif reqfailure.errorCode == shared.ttypes.ErrorCode.AUTH_DENIED:
            print("Authentication denied")
            print(str(reqfailure.message))
        elif reqfailure.errorCode == shared.ttypes.ErrorCode.UNAUTHORIZED:
            print("Unauthorized to access")
            print(str(reqfailure.message))
        else:
            print("API call error: " + funcName)
            print(str(reqfailure))

        raise

    except TProtocolException as ex:
        print("Connection failed to {0}:{1}".format(self.__host, self.__port))
        print("Check if your CodeChecker server is running.")
        sys.exit(1)
    except socket.error as serr:
        print("Connection failed to {0}:{1}".format(self.__host, self.__port))
        errCause = os.strerror(serr.errno)
        print(errCause)
        print(str(serr))
        print("Check if your CodeChecker server is running.")
        sys.exit(1)
    finally:
        self.transport.close()