Fork me on GitHub
#pathom
<
2021-10-26
>
Matthew Thompson16:10:32

Hi everyone! In Pathom3, is there a way to use wrap-resolver-error or similar to replace an exception thrown in a resolver with a custom error key in the returned output from the resolver? I just want to be able to log errors and put an error key of my own in the returned results.

wilkerlucio16:10:59

it should be possible, yes, if not please bring a case and we can look together

wilkerlucio16:10:08

another option is to use the Lenient Mode, which never throws

Matthew Thompson09:10:10

The issue I have is that with lenient mode on, instead of throwing the exception, the exception message and stacktrace gets returned in the output of the resolver. This causes issues later when attempting to marshall this output into transit. I'd just like to replace the exception in the output with a key so i know there was an exception.

donavan15:10:41

I think what we would like is for something like ::pcr/wrap-resolver-error to be able to resolve the node with a custom error value, does that make sense Wilker?

wilkerlucio15:10:12

you can mutate that in the stats, like the mark-node-error does (the wrap-resolver-error wraps around this function): https://github.com/wilkerlucio/pathom3/blob/85a2b0596f9798d97087d301e0579e3e0abc52cb/src/main/com/wsscode/pathom3/connect/runner.cljc#L309

wilkerlucio15:10:51

(or throw directly, if that's the case)

wilkerlucio16:10:02

hello everybody, just a reminder, in ~ 40 min I'll be presenting at London Clojurians about Pathom 3! if you have the time I would love to see you there! https://clojurians.slack.com/archives/C03RZRRMP/p1634644636108900

clojure-spin 7
💯 5
pathom 4
pithyless19:10:51

Thanks for the presentation @wilkerlucio! And for all the ongoing work in Pathom3.

🙏 1
pithyless19:10:30

P.S. Demo gods weren't particularly angry; I'd say all things considered - Great Success! :)

wilkerlucio19:10:34

hahha, happy it worked after all, now that I'm thinking about it, the problem was that the number was bigger than the JS supports, and was probably lost precision on the wire or something

❤️ 1
wilkerlucio19:10:45

while the string doesn't have this issue (and worked 🙂)

Jakub Holý (HolyJak)19:10:12

Hi! Why I query for a nested entity attribute without a join such as :family/members, I get by default all the data (i.e. the name, id, ... of each member). On the other hand, if I query for an entity by ident (such as [:person/id 1]) I do not get back all its attributes by default but only the ident itself. Why is that?

wilkerlucio19:10:47

its because idents are just a single attribute provider, when you use though a link, that resolver is already providing some data (and that's what you get when you don't asked for the details of it), but the ident will just give a single attribute, and wont call any resolver

mauricio.szabo21:10:59

Hi @wilkerlucio - I think I found a bug on Pathom3, batch resolvers, and params. I opened an issue here, please let me know if I can help in some way to fix it: https://github.com/wilkerlucio/pathom3/issues/105