Fork me on GitHub
Jakub Holý (HolyJak)11:11:51

A question about P3 and error handling. According to, this

      (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)

Jakub Holý (HolyJak)08:11:43

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/env     {::p/reader [p/map-reader
    ::p/mutate  pc/mutate-async
    ::p/plugins [(pc/connect-plugin {::pc/register resolvers})
                 (p/post-process-parser-plugin p/elide-not-found)]}))


Anyway, thanks for clearing it up.


Btw, Pathom 3 docs provide a very good introduction. Good job!

🙏 1