@@ -214,29 +214,37 @@ def _evaluate_clause(self, clause: Clause, target: Target) -> bool:
214214 operator = clause .op .lower ()
215215 type = target .get_type (clause .attribute )
216216
217- if type is None :
218- if operator == SEGMENT_MATCH_OPERATOR .lower ():
219- log .debug ("Clause operator is %s, evaluate on segment" ,
220- operator )
221- return self ._check_target_in_segment (clause .values , target )
222- log .debug ("Attribute type %s is none return false" , type )
223- return False
224- log .debug ("evaluate clause with object %s operator %s and value %s" ,
225- type , operator .upper (), clause .values )
226- if operator == IN_OPERATOR .lower ():
227- return type .in_list (clause .values )
228- if operator == EQUAL_OPERATOR .lower ():
229- return type .equal (clause .values )
230- if operator == GT_OPERATOR .lower ():
231- return type .greater_than (clause .values )
232- if operator == STARTS_WITH_OPERATOR .lower ():
233- return type .starts_with (clause .values )
234- if operator == ENDS_WITH_OPERATOR .lower ():
235- return type .ends_with (clause .values )
236- if operator == CONTAINS_OPERATOR .lower ():
237- return type .contains (clause .values )
238- if operator == EQUAL_SENSITIVE_OPERATOR .lower ():
239- return type .equal_sensitive (clause .values )
217+ try :
218+ if type is None :
219+ if operator == SEGMENT_MATCH_OPERATOR .lower ():
220+ log .debug ("Clause operator is %s, evaluate on segment" ,
221+ operator )
222+ return self ._check_target_in_segment (clause .values , target )
223+ log .debug ("Attribute type %s is none return false" , type )
224+ return False
225+ log .debug ("evaluate clause with object %s "
226+ "operator %s and value %s" ,
227+ type , operator .upper (), clause .values )
228+ if operator == IN_OPERATOR .lower ():
229+ return type .in_list (clause .values )
230+ if operator == EQUAL_OPERATOR .lower ():
231+ return type .equal (clause .values )
232+ if operator == GT_OPERATOR .lower ():
233+ return type .greater_than (clause .values )
234+ if operator == STARTS_WITH_OPERATOR .lower ():
235+ return type .starts_with (clause .values )
236+ if operator == ENDS_WITH_OPERATOR .lower ():
237+ return type .ends_with (clause .values )
238+ if operator == CONTAINS_OPERATOR .lower ():
239+ return type .contains (clause .values )
240+ if operator == EQUAL_SENSITIVE_OPERATOR .lower ():
241+ return type .equal_sensitive (clause .values )
242+ except ValueError :
243+ log .debug ("couldn't convert %s to type %s" , clause .values , type )
244+ except Exception as e :
245+ log .warning ("exception processing clause: "
246+ "values: %s, type: %s, "
247+ "error: %s" , clause .values , type , e )
240248 # unknown operation
241249 return False
242250
0 commit comments