Fork me on GitHub
#cljfx
<
2023-12-16
>
Jonathan Bennett09:12:54

Ok, I'm trying to figure out how to use to get useful error messages, but I cannot figure out what how I'm supposed to do it if I'm also using contexts

Jonathan Bennett09:12:48

Here's my renderer and my main fn, which is where I think the documentation says I'm supposed to make the change:

(def renderer
  (fx/create-renderer
    :middleware (comp
                  fx/wrap-context-desc
                  (fx/wrap-map-desc (fn [_] {:fx/type views/root})))
    :error-handler (bound-fn [^Throwable ex]
                     (.printStackTrace ^Throwable ex *err*))
    :opts {:fx.opt/map-event-handler event-handler
           :fx.opt/type->lifecycle #(or (fx/keyword->lifecycle %)
                                        (fx/fn->lifecycle-with-context %))
           }))

(defn -main
  []
  (Platform/setImplicitExit true)
  (fx/mount-renderer *state renderer))
Where do I add the relevant :fx.opt/type->lifecycle ? It's an or, do I just drop it in there?

Jonathan Bennett03:12:47

Ok, so when I try that I get the following error. And removing that wrap removes the error:

clojure.lang.ExceptionInfo: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null

Jonathan Bennett03:12:52

I'm currently not using the devMode? flag, I'm just hard-coding it in first to test it. The relevant opt looks like this:

:opts {:fx.opt/map-event-handler event-handler
           :fx.opt/type->lifecycle (cljfx.dev/wrap-type->lifecycle
                                    #(or (fx/keyword->lifecycle %)
                                         (fx/fn->lifecycle-with-context %)))}))

vlaaad07:12:04

What's the stack trace?