This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-24
Channels
- # announcements (4)
- # asami (5)
- # babashka (20)
- # beginners (94)
- # bristol-clojurians (1)
- # calva (23)
- # cider (2)
- # clj-commons (3)
- # clj-kondo (43)
- # cljfx (2)
- # cljs-dev (13)
- # clojure (112)
- # clojure-dev (44)
- # clojure-europe (17)
- # clojure-nl (5)
- # clojure-poland (12)
- # clojure-spec (2)
- # clojure-uk (3)
- # clojurebridge (1)
- # clojurescript (92)
- # cursive (17)
- # data-science (8)
- # datahike (1)
- # datalevin (1)
- # datomic (3)
- # deps-new (7)
- # events (2)
- # fulcro (40)
- # graalvm (110)
- # holy-lambda (16)
- # introduce-yourself (1)
- # lsp (13)
- # malli (8)
- # missionary (12)
- # off-topic (10)
- # pathom (13)
- # polylith (10)
- # portal (28)
- # re-frame (37)
- # reitit (1)
- # releases (1)
- # shadow-cljs (30)
- # spacemacs (1)
- # tools-deps (9)
- # xtdb (10)
A question about P3 and error handling. According to https://pathom3.wsscode.com/docs/error-handling#optionality, this
(p.eql/process
(pci/register
(pco/resolver 'error
{::pco/output [:error]}
(fn [_ _]
(throw (ex-info "Deu ruim." {})))))
[(pco/? :error)]))
should throw an exception but returns {}
using Pathom 2021.07.10-alpha Why?
Changing the query to [:error ::pcr/attribute-errors]
does not influence the result.I just tried to reproduce but I see an error when I run this code here :thinking_face:
but try upgrading, latest is 2021.11.16-alpha
(I tested over the main branch here)
I have changed to that version and now:
1. The query [(pco/? :error)]
returns nil
2. The query [:error]
throws an exception
I noticed something while transitioning my resolvers from Pathom 2 to 3. Consider the following resolvers:
(pco/defresolver main-tree-resolver []
{::pco/output [{:side [:root/id {:root/list [:id]}]}]}
{:main {:root/id :main :root/list [{:id 1} {:id 2}]}}) ; {:id 1}
(pco/defresolver side-tree-resolver []
{::pco/output [{:side [:root/id {:root/list [:id]}]}]}
{:side {:root/id :side :root/list [[:id 1] [:id 2]]}}) ; [:id 1]
(pco/defresolver id-resolver [{id :id}]
{::pco/output [:id :text]}
(...)
Running the EQL query
[{:main [:root/id {:root/list [:id :text]}]}]
resolves everything, while the same query for :side
doesn't resolve elements from :root/list
.
Which is fine (though, not how it worked for Pathom 2). But consider that main-tree-resolver
doesn't return a :root/list
vector of Fulcro-style idents, so it could not feed the client database. So, I guess I'm making a mistake somewhere?the example here has something wrong, the main-tree-resolver
output has :side
at root
but about [:id 1]
, to Pathom that's a vector with two elements, the concept of ident pointer like that is Fulcro only, in Pathom each item must always be a map with the available context (like at the main-tree-resolver
values)
seems strange that this works on P2, the premise is the same there, maybe some plugins, or using some custom reader could change the behavior, but I dont expect that work by default
> the example here has something wrong, the `main-tree-resolver` output has `:side` at root
Copying error, sorry.
This was the parser I used for P2 with Fulcro's mock-http-server
:
(def pathom-parser
(p/parallel-parser
{::p/env {::p/reader [p/map-reader
pc/parallel-reader
pc/open-ident-reader]}
::p/mutate pc/mutate-async
::p/plugins [(pc/connect-plugin {::pc/register resolvers})
p/error-handler-plugin
p/request-cache-plugin
(p/post-process-parser-plugin p/elide-not-found)]}))