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

Feature Request: Better error handling #986

Closed
melMass opened this issue Mar 26, 2022 · 2 comments · Fixed by #996
Closed

Feature Request: Better error handling #986

melMass opened this issue Mar 26, 2022 · 2 comments · Fixed by #996
Labels
enhancement New feature or request

Comments

@melMass
Copy link

melMass commented Mar 26, 2022

Feature Request

What is the current behavior?

Being faced with errors is usual, but oclif's errors are not very helpful most of the time.

What is the expected behavior?

Either expose the root of the error more clearly. For instance I'm updating my CLI from v1 right now, and one of the subcommands is buggy and I really can't find any infos... here is the output (not asking for support on this I'll open a separate issue if needed, just to prove my point):

Running my cli subcommand:

DEBUG=* mtb resolve-to-nuke --help

  config reading core plugin ~/mtb-cli +0ms
  config loadJSON ~/mtb-cli/package.json +0ms
  config loadJSON ~/mtb-cli/oclif.manifest.json +0ms
  config loadJSON ~/mtb-cli/.oclif.manifest.json +0ms
  config:@mtb/cli loading IDs from ~/mtb-cli/dist/commands +0ms
  config:@mtb/cli found commands [ 'mono', 'resolve-to-nuke', 'mkthumbnail' ] +20ms
  config:@mtb/cli (require) ~/mtb-cli/dist/commands/mono +15ms
  config reading user plugins pjson /Users/mel/.local/share/mtb/package.json +0ms
  config loadJSON /Users/mel/.local/share/mtb/package.json +0ms
(node:82496) [MODULE_NOT_FOUND] ModuleLoadError Plugin: @mtb/cli: [MODULE_NOT_FOUND] require failed to load ~/mtb-cli/dist/commands/resolve-to-nuke
module: @oclif/core@1.6.1
task: toCached
plugin: @mtb/cli
root: ~/mtb-cli
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
ModuleLoadError Plugin: @mtb/cli: [MODULE_NOT_FOUND] require failed to load ~/mtb-cli/dist/commands/resolve-to-nuke
    at Function.loadWithData (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/module-loader.js:85:23)
    at fetch (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/plugin.js:181:83)
    at Plugin.findCommand (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/plugin.js:197:27)
    at ~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/plugin.js:234:73
    at Array.map (<anonymous>)
    at Plugin._manifest (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/plugin.js:232:58)
    at async Plugin.load (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/plugin.js:128:25)
    at async Config.load (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/config.js:86:9)
    at async Function.load (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/config/config.js:80:9)
    at async Object.run (~/node_modules/.pnpm/@oclif+core@1.6.1/node_modules/@oclif/core/lib/main.js:44:20)
module: @oclif/core@1.6.1
task: toCached
plugin: @mtb/cli
root: ~/mtb-cli
See more details with DEBUG=*
  config loading plugins [
  '@oclif/plugin-help',
  '@oclif/plugin-plugins',
  '@oclif/plugin-autocomplete'
] +4ms
  config reading core plugin ~/mtb-cli/node_modules/@oclif/plugin-autocomplete +0ms
  config loadJSON ~/mtb-cli/node_modules/@oclif/plugin-autocomplete/package.json +0ms
  config reading core plugin ~/node_modules/.pnpm/@oclif+plugin-help@5.1.12/node_modules/@oclif/plugin-help +0ms
  config loadJSON ~/node_modules/.pnpm/@oclif+plugin-help@5.1.12/node_modules/@oclif/plugin-help/package.json +0ms
  config reading core plugin ~/node_modules/.pnpm/@oclif+plugin-plugins@2.1.0/node_modules/@oclif/plugin-plugins +0ms
  config loadJSON ~/node_modules/.pnpm/@oclif+plugin-plugins@2.1.0/node_modules/@oclif/plugin-plugins/package.json +0ms
  config loadJSON ~/mtb-cli/node_modules/@oclif/plugin-autocomplete/oclif.manifest.json +0ms
  config loadJSON ~/node_modules/.pnpm/@oclif+plugin-help@5.1.12/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
  config loadJSON ~/node_modules/.pnpm/@oclif+plugin-plugins@2.1.0/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  config:@oclif/plugin-autocomplete using manifest from ~/mtb-cli/node_modules/@oclif/plugin-autocomplete/oclif.manifest.json +0ms
  config:@oclif/plugin-help using manifest from ~/node_modules/.pnpm/@oclif+plugin-help@5.1.12/node_modules/@oclif/plugin-help/oclif.manifest.json +0ms
  config:@oclif/plugin-plugins using manifest from ~/node_modules/.pnpm/@oclif+plugin-plugins@2.1.0/node_modules/@oclif/plugin-plugins/oclif.manifest.json +0ms
  config config done +33ms
  config start init hook +0ms
  config init hook done +1ms
    Error: Command resolve-to-nuke not found.
@pastelsky
Copy link

This is a big problem — when this does happen, one has no choice but to play a game of cat and mouse and start commenting out lines in the command that's failing to load.
There doesn't seem to be an easy way to access the source error.
IMO the CLI should throw explicitly instead of eating up these errors.

@mdonnalley mdonnalley transferred this issue from oclif/oclif Mar 1, 2024
@mdonnalley mdonnalley added the enhancement New feature or request label Mar 1, 2024
Copy link

git2gus bot commented Mar 1, 2024

This issue has been linked to a new work item: W-15161976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants