Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error when paths fed to builder are empty #339

Closed
zampino opened this issue Dec 13, 2022 · 4 comments
Closed

Confusing error when paths fed to builder are empty #339

zampino opened this issue Dec 13, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@zampino
Copy link
Collaborator

zampino commented Dec 13, 2022

This is thrown

Execution error (NullPointerException) at nextjournal.clerk.builder/build-static-app! (builder.clj:284).
Cannot invoke "clojure.lang.IFn.invoke(Object)" because "report_fn" is null

when calling (builder/build-static-app! {:paths ["foo/**/*.clj"]}) against an empty glob "foo/**/*.clj", also reproducible with (builder/build-static-app! {:paths []}).

@zampino zampino added the bug Something isn't working label Dec 13, 2022
@ghost
Copy link

ghost commented Dec 13, 2022

Possibly related: if I pass :paths with a single path — if the options map contains only :paths that works more or less fine. But if I also specify :index then I get the same NPE.

As discussed in Clojurians

@mk mk closed this as completed in 43c02b1 Dec 15, 2022
@kautsig
Copy link

kautsig commented Feb 21, 2023

Can reproduce the problem @aviflat described in :mvn/version "0.12.707". If I understand the code correctly, the problem is that the build-static-app! function, which extracts :keys and then calls process-build-opts which sets the :report-fn.

(let [{:as opts :keys [download-cache-fn upload-cache-fn report-fn compile-css? expanded-paths error]}
        (try (process-build-opts (assoc opts :expand-paths? true))
             (catch Exception e
               {:error e}))

I am not sure how empty paths fix relate to this though.

@kautsig
Copy link

kautsig commented Feb 21, 2023

My previous comment is wrong. I failed to read the let binding correctly. I am still investigating the NPE.

@kautsig
Copy link

kautsig commented Feb 21, 2023

Ok, I got it.

process-build-opts threw an error, never setting report-fn at all. Root cause was:

`:index` must be string and point to existing file`.

No reason to reopen that, sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants