-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move match? exception to flow execution time #125
Conversation
7b80eb0
to
b9dc683
Compare
@@ -101,11 +101,12 @@ | |||
(testing "with times-to-try > 1 and a value instead of a step" | |||
(testing "throws" | |||
(is (re-find #"actual must be a step or a flow when :times-to-try > 1" | |||
(.. (try | |||
(eval `(mc/match? 3 (+ 30 7) {:times-to-try 2})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eval
here was a hint that we were doing it wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
@@ -10,7 +10,8 @@ | |||
(let [params* (merge {:times-to-try probe/default-times-to-try | |||
:sleep-time probe/default-sleep-time | |||
:caller-meta (meta &form) | |||
:description match-desc} | |||
:description match-desc | |||
:called-from-deprecated-match? true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used to tell the non-deprecated version of match? not to throw the times-to-throw
exception so that when people upgrade from state-flow < 2.2.4, they don't start seeing exceptions right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale here is that the old default for times-to-try is 5
, so the old match? was raising exceptions in a lot of cases by default.
Before this PR
match?
would raise an exception at macroexpansion time if it was called in a syntactically correct by semantically incorrect way. With this PR, the update happens at flow execution time instead.Additionally, in order to reduce upgrade friction, that exception is not thrown at all when calling the deprecated
state-flow.cljtest/match?
fn.