8787
8888
8989class ExpressionError (Exception ):
90- def __init__ (self , message , token_string = None ):
91- super ().__init__ (message )
92- self .token_string = token_string
90+ pass
9391
9492
9593class ExpressionParseError (ParseError , ExpressionError ):
@@ -787,10 +785,14 @@ def validate(self, expression, strict=True, **kwargs):
787785 # Check `expression` type and syntax
788786 try :
789787 parsed_expression = self .parse (expression , strict = strict )
790- except ExpressionError as e :
788+ except ExpressionParseError as e :
791789 expression_info .errors .append (str (e ))
792790 expression_info .invalid_symbols .append (e .token_string )
793791 return expression_info
792+ except ExpressionError as e :
793+ expression_info .errors .append (str (e ))
794+ expression_info .invalid_symbols .append (str (expression ))
795+ return expression_info
794796
795797 # Check `expression` keys (validate)
796798 try :
@@ -1212,8 +1214,7 @@ def __init__(
12121214 raise ExpressionError (
12131215 "Invalid license key: the valid characters are: letters and "
12141216 "numbers, underscore, dot, colon or hyphen signs and "
1215- f"spaces: { key !r} " ,
1216- token_string = f"{ key !r} " ,
1217+ f"spaces: { key !r} "
12171218 )
12181219
12191220 # normalize spaces
@@ -1222,8 +1223,7 @@ def __init__(
12221223 if key .lower () in KEYWORDS_STRINGS :
12231224 raise ExpressionError (
12241225 'Invalid license key: a key cannot be a reserved keyword: "or",'
1225- f' "and" or "with": { key !r} ' ,
1226- token_string = f"{ key !r} " ,
1226+ f' "and" or "with": { key !r} '
12271227 )
12281228
12291229 self .key = key
0 commit comments