pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
fatihict 2021-06-15T11:20:06.078200Z

I have a question about error handling in Pathom. I'm using Pathom with the sha 304a6b3a56d588eab50f7f6eaf2c2c7b31750782 The code below returns the attribute errors as I would expect, but the same code returns an empty map when using the latest sha acf3134aa52668d83cffd326c46fca1ef0120e99.

(p.eql/process
    (-> (pci/register
          (pbir/constantly-fn-resolver :error-demo
            (fn [_] (throw (ex-info "Example Error" {})))))
      (p.plugin/register
        [pbip/remove-stats-plugin
         (pbip/attribute-errors-plugin)]))
    [:error-demo])
=> {:com.wsscode.pathom3.connect.runner/attribute-errors {:error-demo #error{:message "Example Error", :data {}}}} 

wilkerlucio 2021-06-15T13:24:11.078300Z

hello @fatihict, great to see you around again 🙂

wilkerlucio 2021-06-15T13:24:36.078500Z

I checked it out, and indeed it as a problem, you can fix it by removing the pbip/remove-stats-plugin

wilkerlucio 2021-06-15T13:25:47.078700Z

I'm thinking about some of the plugin architecture, I noticed later in the game a problem relateed to the idea I came up when combined with batch resolvers

wilkerlucio 2021-06-15T13:26:16.078900Z

that lead to a need to change the implementation of attribute-errors-plugin, and now I see the new way isn't compatible with remove-stats-plugin anymore

fatihict 2021-06-15T13:27:11.079100Z

Hey Wilker 👋

fatihict 2021-06-15T13:27:36.079300Z

Ah oke, that is good to know. Thanks for clarifying.

mauricio.szabo 2021-06-15T20:51:35.085800Z

Hi, @wilkerlucio. I've been trying to use priority on the resolvers on Pathom3, and I have to be honest: I keep getting unpredictable results. I'll try to hack something to see if I can somewhat change the prioritization, and I know we already discussed this on https://github.com/wilkerlucio/pathom3/discussions/57 - I'm just giving some feedback on my feelings about this new feature 🙂

wilkerlucio 2021-06-15T20:52:58.085900Z

thanks, as we talked before, this still a first idea for it, glad that you are finding issues, can you add more details on the discussion? explain some case that doesn't work, so we can think about how we can make it better

mauricio.szabo 2021-06-15T20:55:49.086100Z

Right, so the case I sent on the discussion was one example. What I find is that weights more in the prioritization is mostly resolved on intermediate steps to get to the goal. So sometimes you ask for :a, and :a is reachable both from a "2" and "1" priority, but what weights more are intermediate steps that may not exist on both graphs on the path to get :a

mauricio.szabo 2021-06-15T20:56:32.086300Z

(I don't know if my last explanation made any sense 😄)

mauricio.szabo 2021-06-15T21:14:13.088800Z

Also, another question: is there a way (planned or not) to get, from a resolver, which attributes were asked on the query? I'm thinking about a resolver, for example, that outputs [:person/name :person/age :person/id] and can somehow issue a SQL query with only the attributes that the query asked...

wilkerlucio 2021-06-15T21:28:23.088900Z

this is a problem for dynamic resolvers, which is the thing I'm currently working on

mauricio.szabo 2021-06-15T22:17:33.089100Z

Is there any documentation on how they will work in the future, or something? 🙂

wilkerlucio 2021-06-15T23:02:54.089900Z

not yet, but maybe you can work some partial thing with the current stuff

wilkerlucio 2021-06-15T23:03:49.091700Z

to answer your question more directly, inside env, if you get the ::pcp/node, inside of it there is ::pcp/expects, which is the attributes expected from the resolver

mauricio.szabo 2021-06-15T23:45:17.093Z

Also, one last question: When something fails, it shows some errors like:

:definition/contents
   {:com.wsscode.pathom3.error/error-type
    :com.wsscode.pathom3.error/node-errors,
    :com.wsscode.pathom3.error/node-error-details
    {3
     {:com.wsscode.pathom3.error/error-type
      :com.wsscode.pathom3.error/attribute-missing},
     4
     {:com.wsscode.pathom3.error/error-type
      :com.wsscode.pathom3.error/attribute-missing}}}},
Is it possible to also add the resolver name, so it's easier to debug problems? (also, great work on this feature, it helps a lot!)

mauricio.szabo 2021-06-15T23:45:53.093100Z

Nice, will try it soon-ish 🙂