Skip to content

Commit

Permalink
fix: add error stack logging on --verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron committed Mar 15, 2022
1 parent b0346a0 commit 5d0a41c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/BaseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ const {
class BaseCommand extends Command {
// default error handler for app commands
async catch (error) {
const { flags } = this.parse(this.prototype)
aioLogger.error(error) // debug log
this.handleError(error)
this.handleError(error, flags.verbose)
}

handleError (error) {
handleError (error, verbose) {
const errorMessages = ['no such file or directory', 'find configuration']

if (errorMessages.find(msg => error.message.includes(msg))) {
const errorList = [
'Not a valid application root folder.',
'Please run \'aio app\' commands from a folder generated by aio app init',
error.message
verbose ? error.stack : error.message
]
this.error(errorList.join('\n'))
}
Expand Down

0 comments on commit 5d0a41c

Please sign in to comment.