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?
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 "<http://example.com|example.com>" {: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?Figure out what the server receives. Seems like the query has something that it shouldn't have, i.e. a non-CLJS data structure.
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.
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
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.
hmmm I moved it back just to check and I'm getting the same error
the query worked before moving it out, I guess I changed something else 😅
thanks
would have barked up the wrong tree much longer haha