From cd93b3e5579da4a41562f862a9fd5eed63dca2ba Mon Sep 17 00:00:00 2001 From: xificurC Date: Thu, 5 Sep 2024 16:01:31 +0200 Subject: [PATCH] [fpe] check flow initialization 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. --- src/hyperfiddle/incseq/flow_protocol_enforcer.cljc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hyperfiddle/incseq/flow_protocol_enforcer.cljc b/src/hyperfiddle/incseq/flow_protocol_enforcer.cljc index f8e91bfe8..0b181e80c 100644 --- a/src/hyperfiddle/incseq/flow_protocol_enforcer.cljc +++ b/src/hyperfiddle/incseq/flow_protocol_enforcer.cljc @@ -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) [_]