Malformed :cljdoc.doc/tree potentially causes IllegalArgumentException
If a cljdoc.edn file contains a malformed entry for :cljdoc.doc/tree the result can be an IllegalArgumentException when cljdoc attempts to render the documents.
Here is an example of such a document.
java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
at clojure.lang.RT.seqFrom (RT.java:557)
clojure.lang.RT.seq (RT.java:537)
clojure.core$seq__5402.invokeStatic (core.clj:137)
clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:24)
clojure.core.protocols$fn__8136.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__8088$G__8083__8101.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6828)
clojure.core$mapv.invokeStatic (core.clj:6903)
clojure.core$mapv.invoke (core.clj:6903)
cljdoc.doc_tree$process_toc.invokeStatic (doc_tree.clj:132)
cljdoc.doc_tree$process_toc.invoke (doc_tree.clj:122)
cljdoc.analysis.git$analyze_git_repo$fn__26047.invoke (git.clj:83)
cljdoc.analysis.git$analyze_git_repo.invokeStatic (git.clj:55)
cljdoc.analysis.git$analyze_git_repo.invoke (git.clj:43)
cljdoc.server.ingest$ingest_git_BANG_.invokeStatic (ingest.clj:42)
cljdoc.server.ingest$ingest_git_BANG_.invoke (ingest.clj:38)
cljdoc.server.api$kick_off_build_BANG_$fn__27805.invoke (api.clj:70)
clojure.core$binding_conveyor_fn$fn__5754.invoke (core.clj:2030)
clojure.lang.AFn.call (AFn.java:18)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
java.lang.Thread.run (Thread.java:748)
I think cljdoc.doc-tree/process-toc should validate its arguments and produce a helpful error message. I'm happy to assist with this patch provided I understand the grammar of the expected data structure. I haven't looked much into this yet so I don't if specs exist for this purpose or not. Either way, the above error message is a really bad synonym for something like
ExceptionInfo: `:cljdoc.doc/tree` must be of the form <whatever that is here>
Hi Joel! Specs do exist but I maybe they are lacking in one way or another. Definitely happy about improvements in this regard.
I also remember that there was some issue to store and render exceptions that happen during the Git analysis (like this one) but I can't seem to find it right now.
@martinklepsch Thanks for the pointer. I plan to investigate this issue within the next week or so. Do you remember that other ticket? I haven't dug through the open issues yet but I might be able to help with that one as well.
I still can't find it but I created this issue now: https://github.com/cljdoc/cljdoc/issues/363 — it's a little brief right now so let me know if that is sufficient or if parts are unclear. Also happy to chat more on Slack etc.