Skip to content

Commit 6759b1e

Browse files
author
Sam Harrison
committed
fix: don't display "undefined" when no profiles exists
If you've not created a profile yet and attempt to run a command that requires auth, you would see that the profile "undefined" could not be found. This change just updates the wording to indicate that a profile could not be found to use. Relates to twilio/twilio-cli#148
1 parent 8284a4e commit 6759b1e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/base-commands/twilio-client-command.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class TwilioClientCommand extends BaseCommand {
3131
};
3232

3333
if (!this.currentProfile) {
34-
this.logger.error(`Could not find profile "${this.flags.profile}".`);
34+
const profileName = this.flags.profile ? ` "${this.flags.profile}"` : '';
35+
this.logger.error(`Could not find profile${profileName}.`);
3536
reportUnconfigured('create', '\n\n' + HELP_ENVIRONMENT_VARIABLES);
3637
}
3738

test/base-commands/twilio-client-command.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('base-commands', () => {
8585
setUpTest(['-l', 'debug'], { setUpUserConfig: () => 0 })
8686
.exit(1)
8787
.it('should fail for a non-existent active profile', ctx => {
88-
expect(ctx.stderr).to.contain('Could not find profile');
88+
expect(ctx.stderr).to.contain('Could not find profile.');
8989
expect(ctx.stderr).to.contain('To create the profile, run:');
9090
expect(ctx.stderr).to.contain('twilio profiles:create');
9191
expect(ctx.stderr).to.contain('TWILIO_ACCOUNT_SID');
@@ -94,7 +94,7 @@ describe('base-commands', () => {
9494
setUpTest(['-p', 'alt', '-l', 'debug'])
9595
.exit(1)
9696
.it('should fail for a non-existent profile', ctx => {
97-
expect(ctx.stderr).to.contain('Could not find profile');
97+
expect(ctx.stderr).to.contain('Could not find profile "alt".');
9898
expect(ctx.stderr).to.contain('To create the profile, run:');
9999
expect(ctx.stderr).to.contain('twilio profiles:create --profile "alt"');
100100
expect(ctx.stderr).to.contain('TWILIO_ACCOUNT_SID');

0 commit comments

Comments
 (0)