Fork me on GitHub
#pathom
<
2021-01-22
>
royalaid15:01:48

@wilkerlucio is error handling for pathom3 still up in the air per the older blog post?

wilkerlucio16:01:04

yeah, I'm having some ideas, but before I say them, I like to hear how you think a good error strategy would be

wilkerlucio16:01:54

on Pathom 2 I copied what GraphQL was doing, and have just a separate branch of data for errors, and later add some helpers to move the error closer to the entity (for UI development that seemed a better strategy)

wilkerlucio16:01:57

what you think about these current ones? and do you have another idea about how they could be?

wilkerlucio16:01:59

currently depends on what you need. I think smart maps are fine, you can have errors out on them. for EQL there are more nuances. if you are not crossing the process, then each map contains all the data you need in the meta, you can use some helpers to find out about specific attribute errors. the wire is a different issue, during development is a good idea to send all the meta over the wire (this empowers pathom viz to do its things), but in prod its a lot of data to keep sending. my current idea is to have built-in plugins to handle that, they process the errors and include in the output, then we can remove the meta and just keep the errors

royalaid01:01:51

I spent some time on this for a while today and think that the idea of "errors" is overloaded and so it hard to pin things down to a simple implementation. Your comments above highlight this, a user accessing something they aren't authorized to is very different than a NPE in a function that formats a string. Ultimately I couldn't really think of a way to add anything useful to what pathom 2 did.

markaddleman18:01:38

On the subject of pathom errors. It would be convenient if the EQL response would also include the full exception in data (or object) form rather than string form. For example,

com.wsscode.pathom.core/errors: {
[[:data-source/id {:portfolioKey "xyz", :appKey "xyz"}] :entity.default]: "class com.google.cloud.bigquery.BigQueryException: 401 Unauthorized
POST "
[[:data-source/id {:portfolioKey "xyz", :appKey "xyz"}] :entities]: "class com.google.cloud.bigquery.BigQueryException: 401 Unauthorized
POST "
}

markaddleman18:01:45

This is from pathom2 ^^

wilkerlucio18:01:40

@markaddleman thats a default that was picked because on that time Pathom was used mostly on the wire, but in highsigth was a bad pick. in pathom 3 the standard will keep errors as-is. you can change that in Pathom 2 adding the following to your env: ::p/process-error (fn [env e] e)

markaddleman18:01:13

ah, that's great and makes my debugging life MUCH better

wilkerlucio18:01:12

MVP of tooling for Pathom 3 is out 🎉 ! There is a new version of Pathom Viz app, you can download it at: https://github.com/wilkerlucio/pathom-viz/releases/tag/v2021.1.22-1. More important, there is an update to the connector library: https://github.com/wilkerlucio/pathom-viz-connector If you just update the connector library, you can use it with Pathom 3, updating the app gives you: - Support to see the root graph rendering (this view is a work in progress) - Logs tab (to log plans) - Improved auto-complete algorithm Here you can find an example usage (there is also in the README for the connector lib): https://github.com/wilkerlucio/pathom-viz-connector/blob/master/examples/com/wsscode/pathom_viz/connector/demos/pathom3.clj

🎉 34
wilkerlucio18:01:29

just also make sure you are on pathom 3 latest commit