Skip to content

Commit

Permalink
fix: improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
RodEsp committed Mar 15, 2021
1 parent 5033f35 commit 1cb5def
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/commands/auth/sfdxurl/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ export default class Store extends SfdxCommand {
? await this.getUrlFromJson(authFile)
: await fs.readFile(authFile, 'utf8');

const oauth2Options = AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl);
let oauth2Options: AuthFields;
try {
oauth2Options = AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl);
} catch (e) {
this.ux.error(
`Error getting the auth URL from file ${authFile}. Please ensure it meets the description shown in the documentation for this command.`
);
this.ux.error(this.statics.description);
return;
}

const authInfo = await AuthInfo.create({ oauth2Options });
await authInfo.save();

Expand Down

0 comments on commit 1cb5def

Please sign in to comment.