This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-16
Channels
- # admin-announcements (2)
- # bangalore-clj (3)
- # beginners (15)
- # boot (303)
- # carry (18)
- # cider (7)
- # cljs-dev (222)
- # cljsrn (103)
- # clojure (196)
- # clojure-czech (2)
- # clojure-russia (69)
- # clojure-spec (21)
- # clojure-uk (48)
- # clojurescript (68)
- # cursive (18)
- # datomic (185)
- # events (1)
- # hoplon (2)
- # lambdaisland (1)
- # leiningen (1)
- # mount (10)
- # off-topic (1)
- # om (14)
- # onyx (154)
- # parinfer (1)
- # pedestal (3)
- # planck (5)
- # protorepl (9)
- # re-frame (17)
- # reagent (27)
- # ring (2)
- # specter (58)
- # test-check (1)
- # testing (7)
- # untangled (59)
- # yada (35)
Currently running into an issue with mount
:
I have a setup similar to the first example in the README:
(defstate conn :start (create-conn)
:stop (disconnect conn))
However, create-conn
might fail. In those cases, we log the issue, and return nil. However, mount
sees that (create-conn)
returned, and sets conn
to the started state.
When trying to stop conn
, we see an exception because disconnect
is a method provided by a protocol (we’ll call it IConn), and conn
, being nil, obviously doesn’t implement that.
I can fix this with a simple stopgap by saying something like (when conn (disconnect conn))
, but I’d prefer a way to signify to mount that the connection wasn’t actually started. Is there a way to do this?They don’t, because they don’t function if conn
is nil
I suppose just throwing an exception would be the simplest actual solution for what I want, which is that the world should stop and mount shouldn’t start up
@surreal.analysis: we do have an open discussion about failures on start: https://github.com/tolitius/mount/issues/50
but I agree, :start
just takes a function, if the function fails, it should throw, and if it does that mount won't start the state