Fork me on GitHub
Alex Miller (Clojure team)15:06:37

you're just getting the spammed ex-info data there, not a crafted message

Alex Miller (Clojure team)15:06:45

which clojure version and where are you seeing this?

Alex Miller (Clojure team)15:06:25

seeing it in repl (if so, which repl) or from lein command or other command?


Getting back to this problem. I did some digging and it turns out, if I run this function as part of a web request it gets wrapped into a exception clojure.lang.ExceptionInfo and printed out like seen above vs calling the function from the repl and seeing the more readable output. What would be the idiomatic way to use spec in this environment? I could catch the exception, and display some better error? Is it possible to extract a more readable error from the exception? Two things that bug me here. 1. ExceptionInfo seems like a very generic exception and I would have to look into it to check if its a exception regarding spec. 2. I would have to do this for every function that accepts / returns a web request while I would like to have it printed readable everytime, without having to do manual exception handling, if possible.


I see this in the cursive REPL when running a function of mine that I specced. There is also a lengthy stacktrace available and what fails is clojure.spec.test.alpha$spec_checking_fn$conform_BANG___3024.invoke Clojure version is 1.10.1 and spec is spec.alpha 0.2.176

Alex Miller (Clojure team)16:06:19

what kind of repl in Cursive?

Alex Miller (Clojure team)16:06:18

I'm most likely going to suggest you ask in #cursive as its really dependent on who is controlling the printing, which here is either cursive or nrepl

Alex Miller (Clojure team)16:06:05

that is, if you used lein or clj in this same scenario, I think you would get a much better output


I post here a variation of something that I posted in #clojurescript this morning, but is essentially a different problem (it affects JVM clojure) I have a ns l from library L which requires clojure.core.specs.alpha, and uses one of its specs via spec/def. And I have a ns a from app A that requires l. When running A, I get java.lang.Exception: Unable to resolve spec: :clojure.core.specs.alpha/params+body. This doesn't happen when running L. I use the Reloaded workflow with vanilla requires and project organisation. All deps are the latest


@alexmiller : The problem appears to boil down to the fact that just that specific spec is absent from the registry

Alex Miller (Clojure team)18:06:37

there were some core spec renames in the 1.10-era core.specs.alpha - are you seeing mismatches maybe?

Alex Miller (Clojure team)18:06:50

yeah params+body was a rename in 1.10-era from 1.9-era

Alex Miller (Clojure team)18:06:44

changes happened in core.specs.alpha 0.2.44

Alex Miller (Clojure team)18:06:11

so would be good to know the version of that being used by L and A, and also whether aot is happening on L


hi! I've been doing archeology for the last hour and I still can't make sense of things even when using 1.10.1 and the latest clojure.core.specs.alpha dep (stable, or snapshot, or none at all, since it's bundled), (require '[clojure.core.specs.alpha] :reload-all) won't get me the params+body spec in this particular project maybe Leiningen is doing sth evil


no aot in either side. tried lein clean, no luck either

Alex Miller (Clojure team)18:06:25

Clojure 1.10.0
user=> (require '[clojure.core.specs.alpha :as sa])
user=> ::sa/params+body
user=> (require '[clojure.spec.alpha :as s])
user=> (s/get-spec ::sa/params+body)
{:clojure.spec.alpha/op :clojure.spec.alpha/pcat, :ps [:clojure.core.specs.alpha/param-list {:clojure.spec.alpha/op :clojure.spec.alpha/alt, :ps ({:clojure.s...


yes, in the original library ("L") it just works in a larger app ("A") using L it doesn't Did whatever I could to bisect, no luck I'll try creating another app, since A is quite large tbh, increasing the chances for weird interactions

Alex Miller (Clojure team)18:06:08

does the registry contain any of the core.specs.alpha stuff?


most of them yes. see #clojure , found the thing


@alexmiller its the same in the clj repl. But I have a lot of libraries loaded, not sure of something messes around with the output.


did some googling but not found the anwser, is it possible to share specs between clj and cljs files? do I need to write .cljx files?

Alex Miller (Clojure team)22:06:39

you can write specs in .cljc files and share them

👍 4

any recommended documentation on how to setup clc files and share them? something has to be done in project.clj?


@U3QUAHZJ6 It's mostly automatic. The compilers look for both .cljc files and their own suffix (`.clj` or .cljs).

Alex Miller (Clojure team)22:06:07

.cljx is old and shouldn't be used anymore