Skip to content

Commit

Permalink
[fpe] check flow initialization
Browse files Browse the repository at this point in the history
Strictly speaking this is not correct, since uninitialized flows are
valid flows. But for the purpose of electric we work with initialized
ones. We can remove or make this check optional in the future if need
be.
  • Loading branch information
xificurC committed Sep 5, 2024
1 parent 19cf43b commit cd93b3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hyperfiddle/incseq/flow_protocol_enforcer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
(if (first (swap-vals! !should-step? not)) (cannot-throw nm step) (violated nm "double step")))
done (fn [] (if (first (reset-vals! !done? true)) (violated nm "done called twice") (cannot-throw nm done)))
cancel (try (input-flow step done)
(catch #?(:clj Throwable :cljs :default) e (violated "flow process creation threw" e)))]
(catch #?(:clj Throwable :cljs :default) e (violated nm "flow process creation threw" e)))]
(when (= ::init @!should-step?) (violated nm "missing initial step"))
(reify
IFn (#?(:clj invoke :cljs -invoke) [_] (cannot-throw nm cancel))
IDeref (#?(:clj deref :cljs -deref) [_]
Expand Down

0 comments on commit cd93b3e

Please sign in to comment.