jfmengels / node-elm-review

CLI for elm-review
https://package.elm-lang.org/packages/jfmengels/elm-review/latest/
BSD 3-Clause "New" or "Revised" License
48 stars 25 forks source link

Strange error when running elm-review from a template #153

Closed jxxcarlson closed 4 months ago

jxxcarlson commented 4 months ago

I can't say much more than this:

➜  counter git:(main) npx elm-review --template jxxcarlson/elm-review-codeinstaller --fix-all

✖ Fetching template information
-- UNEXPECTED ERROR ------------------------------------------------------------

I ran into an unexpected error. Please open an issue at the following link:
  https://github.com/jfmengels/node-elm-review/issues/new

Please include this error message and as much detail as you can provide. If you
can, please provide a setup that makes it easy to reproduce the error. That will
make it much easier to fix the issue.

Below is the error that was encountered.
--------------------------------------------------------------------------------
TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at Object.update (/Users/carlson/node_modules/elm-review/lib/template-dependencies.js:269:10)
    at Object.getRemoteElmJson (/Users/carlson/node_modules/elm-review/lib/remote-template.js:101:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async buildFromGitHubTemplate (/Users/carlson/node_modules/elm-review/lib/build.js:209:25)
    at async runElmReview (/Users/carlson/node_modules/elm-review/lib/main.js:65:51)
jxxcarlson commented 4 months ago

Nevermind!

jfmengels commented 4 months ago

What was the issue? To see if I can improve the error message.

jxxcarlson commented 4 months ago

No issue. I made a malformed command and simply didn't realize that.


I've been working on a set of elm-review rules to install code into an app, e.g. all the stuff needed to implement "magic link" authentication. (https://package.elm-lang.org/packages/jxxcarlson/elm-review-codeinstaller/latest/) There were some rough patches along the way, but I'm getting the hang of it and have acquired a wonderful collaborator (Mateus Leite in Brazil).

Bravo to you for elm-review. It is a really powerful and elegant tool.

(PS. We do have tests now!)

jfmengels commented 4 months ago

I made a malformed command

Right, but no malformed command should be able to trigger a runtime error like the one you've had. Instead, the tool should show a nice(r) error message. Do you perhaps remember the command you were trying to run?

It won't solve the issue for you (especially since you've solved it now) but it might help others in the future who run similar commands.