scicloj / clay

A REPL-friendly Clojure tool for notebooks and datavis
https://scicloj.github.io/clay/
Eclipse Public License 1.0
132 stars 13 forks source link

Fail in an informative way in call cases #153

Open daslu opened 2 months ago

daslu commented 2 months ago

We will use this issue to record cases of failures that are hard to debug.

daslu commented 2 months ago

@holyjak reported the following:

In: https://github.com/scicloj/wolframite/tree/6d1a7bae6299545fafd770b3f6fe3edd2723c905 run

clj -T:build build-site

and get:

[:wrote docs/for_scientists.cavity_physics.qmd #inst "2024-09-10T21:24:43.811-00:00"]
"Elapsed time: 2114.116813 msecs"
"Elapsed time: 196.429344 msecs"
"Elapsed time: 1.662475 msecs"
Execution error (IllegalArgumentException) at scicloj.clay.v2.notebook/complete (notebook.clj:39).
Don't know how to create ISeq from: clojure.lang.Symbol

Looks like in certain contexts, the following code: https://github.com/scicloj/wolframite/blob/6d1a7bae6299545fafd770b3f6fe3edd2723c905/notebooks/for_developers/index.clj#L64

(def headers (->> (wl/eval "data[[1]]")
                  (map #(str/replace % "\"" ""))))
(def header->idx (zipmap headers (next (range))))

fails with:

Don't know how to create ISeq from: clojure.lang.Symbol

The reason is that, in some contexts, (wl/eval "data[[1]]") returns the symbol $Failed, and then we cannot map over it.

Anyway, Clay should be more informative about where the failure happens in such situations.