@@ -63,7 +63,7 @@ public static ComparisonOperator GetByOperatorString(string op, bool caseInsensi
6363 var comparisonOperator = List . FirstOrDefault ( x => x . Operator ( ) == op ) ;
6464 if ( comparisonOperator == null )
6565 {
66- throw new Exception ( $ "Operator { op } is not supported") ;
66+ throw new QueryKitParsingException ( $ "Operator { op } is not supported") ;
6767 }
6868
6969 ComparisonOperator ? newOperator = null ;
@@ -162,7 +162,7 @@ public static ComparisonOperator GetByOperatorString(string op, bool caseInsensi
162162 }
163163
164164 return newOperator == null
165- ? throw new Exception ( $ "Operator { op } is not supported")
165+ ? throw new QueryKitParsingException ( $ "Operator { op } is not supported")
166166 : newOperator ! ;
167167 }
168168
@@ -658,7 +658,7 @@ public override Expression GetExpression<T>(Expression left, Expression right, T
658658 return GetCollectionExpression ( left , right , Expression . Equal , UsesAll ) ;
659659 }
660660
661- throw new Exception ( "DoesNotHaveType is only supported for collections" ) ;
661+ throw new QueryKitParsingException ( "DoesNotHaveType is only supported for collections" ) ;
662662 }
663663 }
664664
@@ -680,7 +680,7 @@ public override Expression GetExpression<T>(Expression left, Expression right, T
680680 return GetCollectionExpression ( left , right , Expression . NotEqual , UsesAll ) ;
681681 }
682682
683- throw new Exception ( "DoesNotHaveType is only supported for collections" ) ;
683+ throw new QueryKitParsingException ( "DoesNotHaveType is only supported for collections" ) ;
684684 }
685685 }
686686
@@ -862,22 +862,22 @@ private Expression GetCountExpression(Expression left, Expression right, string
862862 var leftAsEnumerableType = left . Type . GetInterface ( nameof ( IEnumerable ) ) ;
863863 if ( leftAsEnumerableType == null )
864864 {
865- throw new Exception ( "Left expression should be of type IEnumerable<T>" ) ;
865+ throw new QueryKitParsingException ( "Left expression should be of type IEnumerable<T>" ) ;
866866 }
867867
868868 var leftGenericType = left . Type . GetGenericArguments ( ) [ 0 ] ;
869869 var rightType = right . Type ;
870870
871871 if ( rightType != typeof ( int ) )
872872 {
873- throw new Exception ( "The right expression should be of type int" ) ;
873+ throw new QueryKitParsingException ( "The right expression should be of type int" ) ;
874874 }
875875 var countMethod = typeof ( Enumerable ) . GetMethods ( BindingFlags . Public | BindingFlags . Static )
876876 . FirstOrDefault ( m => m . Name == "Count" && m . GetParameters ( ) . Length == 1
877877 && m . GetParameters ( ) [ 0 ] . ParameterType . GetGenericTypeDefinition ( ) == typeof ( IEnumerable < > ) ) ;
878878 if ( countMethod == null )
879879 {
880- throw new Exception ( "Count method not found" ) ;
880+ throw new QueryKitParsingException ( "Count method not found" ) ;
881881 }
882882
883883 var specificCountMethod = countMethod . MakeGenericMethod ( leftGenericType ) ;
@@ -886,10 +886,9 @@ private Expression GetCountExpression(Expression left, Expression right, string
886886 var comparisonMethod = typeof ( Expression ) . GetMethod ( methodName , new [ ] { typeof ( Expression ) , typeof ( Expression ) } ) ;
887887 if ( comparisonMethod == null )
888888 {
889- throw new Exception ( $ "Comparison method '{ methodName } ' not found") ;
889+ throw new QueryKitParsingException ( $ "Comparison method '{ methodName } ' not found") ;
890890 }
891891
892- // Invoke the comparison method
893892 return ( Expression ) comparisonMethod . Invoke ( null , new object [ ] { countExpression , right } ) ;
894893 }
895894}
0 commit comments