Fork me on GitHub
#clojurescript
<
2021-01-30
>
Carlo17:01:25

good morning! I'd like a suggestion: is there a way of adding specs to functions so that when a function is called, the spec is executed, and if the spec fails I get a complete trace? I checked out ghostwheel (I really liked the co-located queries), but it seems not maintained anymore, and the successor guardrails, on which the documentation for this usecase seems scarce. How do you do this? What libraries would you suggest?

bendy19:01:26

Hello everyone! I'm trying to pass around some quoted code for a dummy project, datalog queries to be specific. I'd have the following:

(def query '[:find ...])

(http/post "" {:edn-params {:query query}})
I'm getting an error in the console:
#error {:message "No reader function for tag object.", :data {:type :reader-exception, :ex-kind :reader-error}}
Whats the proper way of passing along ("referencing") the quoted query?

p-himik20:01:43

Figure out what the server receives. Seems like the query has something that it shouldn't have, i.e. a non-CLJS data structure.

p-himik20:01:25

Or, which should be the same, figure out what the browser sends (assuming you're doing it from a browser). It's actually easier - just look at the Network tab of the DevTools.

bendy21:01:36

If I replace the reference {:query query} with the actually query {:query '[:find ...]} it works, so I don't think there is anything inside the query that is causing problems

p-himik21:01:48

I have no idea why you would see that behavior then. Are you sure that query inside {:query query} is the very same query as in (def query ...), that nothing rebinds the name to something else in that scope? If yes, then maybe http/post is a macro that does something strange. Apart from that, no idea.

bendy21:01:05

hmmm I moved it back just to check and I'm getting the same error

bendy21:01:21

the query worked before moving it out, I guess I changed something else 😅

bendy21:01:26

thanks

👍 3
bendy21:01:35

would have barked up the wrong tree much longer haha