Skip to content

Commit cf19d9e

Browse files
committed
fix: fix error logging with DEBUG=true
1 parent 50c5341 commit cf19d9e

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/commands/create/command.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,15 @@ export class CreateCommand extends BaseCommandHandler<CreateCommandInput> {
7474

7575
process.exit(0);
7676
} catch (error) {
77-
logger.error(
78-
// eslint-disable-next-line max-len
79-
`Encountered an error. Cleaning up working directory. Run command with ${chalk.yellow('DEBUG=true')} to see error details.`,
80-
);
77+
if (process.env.DEBUG === 'true') {
78+
logger.error(error);
79+
} else {
80+
logger.error(
81+
// eslint-disable-next-line max-len
82+
`Encountered an error. Cleaning up working directory. Run command with ${chalk.yellow('DEBUG=true')} to see error details.`,
83+
);
84+
}
85+
8186
logger.info(reportIssuesTip);
8287
await this.cleanProjectDirectory();
8388

@@ -89,7 +94,7 @@ export class CreateCommand extends BaseCommandHandler<CreateCommandInput> {
8994
try {
9095
await fs.rm(path.join(process.cwd(), this.options.projectName), { recursive: true, force: true });
9196
} catch (err) {
92-
if (process.env.DEBUG === 'true') logger.debug(err);
97+
if (process.env.DEBUG === 'true') logger.warn(err);
9398
// Fail silently
9499
}
95100
}

src/commands/create/handlers/LibrarySetup.handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class LibrarySetupHandler extends BaseCommandHandler<CreateCommandInput>
6262
}
6363
} catch (error) {
6464
// Do nothing, not all plugins/adapters will have an init script
65-
if (process.env.DEBUG === 'true') logger.debug(error);
65+
if (process.env.DEBUG === 'true') logger.warn(error);
6666
}
6767
}
6868

0 commit comments

Comments
 (0)