eik-lib / cli

CLI to publish packages and import maps to Eik, and to manage aliases
https://eik.dev
1 stars 3 forks source link

No good error message #554

Closed leftieFriele closed 2 months ago

leftieFriele commented 5 months ago

Description: When trying to update an alias There is an error message which leaves the user guessing:

$ eik package-alias @some-scope/my-module 1.3.0 1

   ╭───────────────────────╮
   │                       │
   │   Eik CLI (v2.0.38)   │
   │                       │
   ╰───────────────────────╯

⚠ Unexpected token u in JSON at position 0

The problem was in this case that the user was not in the right directory, which means the folder of the package.json for the module.

We should be able to let the user know this instead of this error.

wkillerud commented 3 months ago

259 has some perhaps relevant discussion on error output

leftieFriele commented 3 months ago

259 has some perhaps relevant discussion on error output

💯 on the ideas in that issue.

I think there's a difference between errors thrown for whatever reason and things like what is mentioned here which is invalid input because the user is in the wrong directory. When we know something can go wrong, like here when we look for a file. We should be able to tell the user exactly what to do in a message.

wkillerud commented 3 months ago

Seems like this issue is related as well, probably the same root cause (poor error message when run outside the package directory): https://github.com/eik-lib/issues/issues/9