fix: Don't assert on exception in BooleanExpression.evaluate

Bugs (fixed):
  * DataStream WebApp Server sometimes crashes when the user enters a
    bad query.
This commit is contained in:
John Colvin committed 2024-09-22 18:46:10 +00:00
1 parent 21a815c78a
commit 132b7c4e28
1 file changed
+2 -10
@@ -1,19 +1,11 @@
namespace Bts.BooleanExpressions;
using bts;
class BooleanExpression : IBooleanExpression {
readonly Func<IDictionary<string, object?>, bool> evaluate;
public BooleanExpression(Func<IDictionary<string, object?>, bool> evaluate) =>
this.evaluate = evaluate;
public bool Evaluate(IDictionary<string, object?> env) {
try {
return evaluate(env);
} catch (Exception ex) {
Log.assert(false, $"BooleanExpression.Evaluate failed: {ex}");
throw;
}
}
public bool Evaluate(IDictionary<string, object?> env) =>
evaluate(env);
}