This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-11
Channels
- # announcements (4)
- # babashka (4)
- # beginners (164)
- # calva (47)
- # cider (1)
- # cljs-dev (29)
- # cljsrn (3)
- # clojure (137)
- # clojure-europe (23)
- # clojure-nl (3)
- # clojure-spec (7)
- # clojure-uk (44)
- # clojurescript (35)
- # component (8)
- # conjure (119)
- # cursive (32)
- # datomic (12)
- # emacs (31)
- # figwheel-main (36)
- # graalvm (10)
- # jobs (2)
- # kaocha (1)
- # lein-figwheel (3)
- # meander (15)
- # mount (3)
- # off-topic (9)
- # pathom (8)
- # quil (4)
- # re-frame (13)
- # reagent (15)
- # remote-jobs (10)
- # shadow-cljs (128)
- # slack-help (2)
- # spacemacs (8)
- # test-check (6)
- # xtdb (6)
why are mutations referenced by a symbol rather than a keyword? i.e. `'user/create` rather than `:user/create`
also, how to people handle errors client-side?
from apollo graphql I’m used to having separate error property, i.e. the query would return {data, errors, loading}
, but in pathom error is returned in place of the result. not immediately obvious to me why that is and how to best handle that
hello @alidcastano, mutations are symbols to separated than from reads, since mutations and resolvers do fundamental different operations (read vs write), this also aligns with Clojure itself, where keywords are usually a way to read information, while lists with symbols are calls. about the error, pathom by default will give the error in a separated property on the map, similar to GraphQL, but IMO for UI development its easier to have the errors close to the entity that failed, there is a helper to do that p/raise-errors
I was seeing the error as part of mutation result (i.e. {user/create *some error*}
), but perhaps that’s because I have the p/error-handler-plugin
configured
i tried p/raise-errors
but didn’t see it do anything. is it meant to wrap the parser output?
re: symbols. I figured that was the case. just makes it a bit more awkward to use in frontend, since you have to quote/unquote . likely just have to get used to that
oh, mutation errors always go on the mutation itself, resolver errors will use the gql style
I’m trying to figure out best way of thinking about this.
for comparison, in apollo graphql if a mutation errors out you’d catch
the error and data is only returned when promise is resolved.
but in pathom mutations result can resolve to both data or errors. so should I always check that result is not an error before trying to use the actual returned data? (I guess that’s the obvious thing to do, but wondering if there’s any non-obvious approach Im not considering)