Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions QueryKit.UnitTests/FilterParsingRegressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ public void whitespace_around_a_group_gives_the_same_filter(string input, string
result.Should().Equal(expectedResult);
}

[Fact]
public void unknown_logical_operator_throws_query_kit_parsing_exception()
{
var act = () => LogicalOperator.GetByOperatorString("xor");

act.Should().Throw<QueryKitParsingException>().WithMessage("Operator xor is not supported");
}

private static TResult WithCulture<TResult>(string cultureName, Func<TResult> action)
{
var originalCulture = CultureInfo.CurrentCulture;
Expand Down
3 changes: 2 additions & 1 deletion QueryKit/Operators/LogicalOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace QueryKit.Operators;
using System.Linq.Expressions;
using Ardalis.SmartEnum;
using Configuration;
using Exceptions;

public abstract class LogicalOperator : SmartEnum<LogicalOperator>
{
Expand All @@ -15,7 +16,7 @@ public static LogicalOperator GetByOperatorString(string op)
var logicalOperator = List.FirstOrDefault(x => x.Operator() == op);
if (logicalOperator == null)
{
throw new Exception($"Operator {op} is not supported");
throw new QueryKitParsingException($"Operator {op} is not supported");
}
return logicalOperator;
}
Expand Down
Loading