Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How do we figure out what "broke" the expression? #711

Unanswered
rchougule asked this question in General
Discussion options

Hello,

Let's say we have a complex long expression which evaluates to a boolean value. How do we figure out which part "broke" it? i.e. which part led the evaluation to result into false?

For e.g.

let result = Func1() && Var1 == "X" && Func2(Var2) && (Var3 in [x,y,z] || var4 in [a,b,c]);
return result.Value, result.Reason

The above expression might give some idea on the expectation. The result.Reason can be Func2(Var2) is false (let's say).

Thinking out loud here. Do you think this is achievable? I understand that what reason means for one might not mean for someone else. Though, we can try to make it deterministic in some way.

But do you think this is possible?

Thanks,
Rohan Chougule

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

You can use Explain mode from Expr Pro:
image
This way, it is possible to see exactly why expression "broke"

You must be logged in to vote
2 replies
Comment options

Oh, it's a paid feature. Got it.
Though, how will it exactly work via code? Any examples? Will I get a list of these "steps" when I invoke expr.Run?

Comment options

Yes, exactly. You provide code as a string and env object. On output - list of steps as strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /