File tree Expand file tree Collapse file tree
src/main/com/fulcrologic/statecharts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 true
4343 (catch Throwable _ false ))))
4444
45+ ; ; Fail fast on a present-but-too-old promesa. `promesa.core/await!` was added
46+ ; ; in 10.0.570; older versions (e.g. 8.0.450) load fine but lack it, so the
47+ ; ; `(intern ... (deref (resolve 'promesa.core/await!)))` below blows up while
48+ ; ; this namespace is loading. The resulting failure is cryptic and far from the
49+ ; ; root cause (e.g. under shadow-cljs it surfaces as a macro-loading error like
50+ ; ; `No namespace: com.fulcrologic.statecharts.promise found`). Silently falling
51+ ; ; back to native mode would also be unsafe: native `promise?` is
52+ ; ; `(instance? IPending v)`, but a real promesa JVM promise is a CompletionStage
53+ ; ; (NOT IPending), so async expressions returning promesa promises would be
54+ ; ; mis-handled by the engine. So this is a hard error with an actionable message.
55+ #?(:clj
56+ (when (and promesa-available?
57+ (nil? (resolve 'promesa.core/await!)))
58+ (throw (ex-info
59+ (str " An outdated funcool/promesa is on the classpath: "
60+ " com.fulcrologic.statecharts.promise requires promesa.core/await!, "
61+ " which was added in promesa 10.0.570. Upgrade funcool/promesa to "
62+ " >= 10.0.570 (or remove it from the classpath entirely to use the "
63+ " native, promesa-free fallback)." )
64+ {:missing-promesa-sym 'promesa.core/await!
65+ :min-promesa-version " 10.0.570" }))))
66+
4567#?(:clj
4668 (def ^:no-doc mode
4769 " One of `:promesa` or `:native`. CLJ runtime only. Useful for tests
You can’t perform that action at this time.
0 commit comments