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

fix: show actual error when command is not run in an app folder #521

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

shazron
Copy link
Member

@shazron shazron commented Mar 15, 2022

Description

Right now, when you run an aio app command it prints out a Not a valid application root folder error if you are not in an app folder, but the actual error is not printed in a subsequent statement because a this.error call exits the app.

Add the actual exception error message to the error output as well.

Related: adobe/aio-cli#335

How Has This Been Tested?

  1. mkdir foo
  2. cd foo
  3. aio app logs
$ aio app logs
 ›   Error: Not a valid application root folder
 ›   Please run 'aio app' commands from a folder generated by aio app init
 ›   package.json: ENOENT: no such file or directory, open 'package.json'
  1. aio app logs --verbose
$ aio app logs --verbose
 ›   Error: Not a valid application root folder.
 ›   Please run 'aio app' commands from a folder generated by aio app init
 ›   Error: package.json: ENOENT: no such file or directory, open 'package.json'
 ›       at Object.openSync (fs.js:498:3)
 ›       at Object.readFileSync (fs.js:394:35)
 ›       at Object.readFileSync
 ›   (~/git/adobe/aio-cli-plugin-app/node_modules/jsonfile/index.js:50:22)
 ›       at loadCommonConfig (~/git/adobe/aio-cli-plugin-app/node_modules/@ad
 ›   obe/aio-cli-lib-app-config/src/index.js:138:26)
 ›       at loadConfig (~//git/adobe/aio-cli-plugin-app/node_modules/@adobe/ai
 ›   o-cli-lib-app-config/src/index.js:104:24)
 ›       at Logs.getFullConfig
 ›   (~/git/adobe/aio-cli-plugin-app/src/BaseCommand.js:134:24)
 ›       at Logs.run
 ›   (~/git/adobe/aio-cli-plugin-app/src/commands/app/logs.js:35:29)
 ›       at Logs._run (~/git/adobe/aio-cli-plugin-app/node_modules/@oclif/com
 ›   mand/lib/command.js:43:31)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #521 (eb65a5a) into master (a48e58d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #521   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           50        50           
  Lines         2594      2594           
  Branches       469       469           
=========================================
  Hits          2594      2594           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a48e58d...eb65a5a. Read the comment docs.

Copy link
Member

@purplecabbage purplecabbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇 :shipit:

@shazron shazron merged commit 1c0363d into master Mar 16, 2022
@shazron shazron deleted the not-app-folder-error branch March 16, 2022 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants