@@ -1089,20 +1089,23 @@ def query(self):
10891089 def find_delegation (self ):
10901090 def printTable (items , header ):
10911091 colLen = []
1092- for i , col in enumerate (header ):
1093- rowMaxLen = max (len (str (row [i ])) for row in items )
1094- colLen .append (max (rowMaxLen , len (col )))
1095-
1096- # Create the format string for each row
1097- outputFormat = " " .join ([f"{{{ num } :{ width } s}}" for num , width in enumerate (colLen )])
1098-
1099- # Print header
1100- self .logger .highlight (outputFormat .format (* header ))
1101- self .logger .highlight (" " .join (["-" * itemLen for itemLen in colLen ]))
1102-
1103- # Print rows
1104- for row in items :
1105- self .logger .highlight (outputFormat .format (* row ))
1092+ try :
1093+ for i , col in enumerate (header ):
1094+ rowMaxLen = max (len (str (row [i ])) for row in items )
1095+ colLen .append (max (rowMaxLen , len (col )))
1096+
1097+ # Create the format string for each row
1098+ outputFormat = " " .join ([f"{{{ num } :{ width } s}}" for num , width in enumerate (colLen )])
1099+
1100+ # Print header
1101+ self .logger .highlight (outputFormat .format (* header ))
1102+ self .logger .highlight (" " .join (["-" * itemLen for itemLen in colLen ]))
1103+
1104+ # Print rows
1105+ for row in items :
1106+ self .logger .highlight (outputFormat .format (* row ))
1107+ except Exception as e :
1108+ self .logger .fail ("Header Index error " + str (e )) # Seen in line rowMaxlen and highlight row variable
11061109
11071110 # Building the search filter
11081111 search_filter = ("(&(|(UserAccountControl:1.2.840.113556.1.4.803:=16777216)(UserAccountControl:1.2.840.113556.1.4.803:="
0 commit comments