Skip to content

Commit 1cb5def

Browse files
committed
fix: improve error handling
1 parent 5033f35 commit 1cb5def

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/commands/auth/sfdxurl/store.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,17 @@ export default class Store extends SfdxCommand {
6363
? await this.getUrlFromJson(authFile)
6464
: await fs.readFile(authFile, 'utf8');
6565

66-
const oauth2Options = AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl);
66+
let oauth2Options: AuthFields;
67+
try {
68+
oauth2Options = AuthInfo.parseSfdxAuthUrl(sfdxAuthUrl);
69+
} catch (e) {
70+
this.ux.error(
71+
`Error getting the auth URL from file ${authFile}. Please ensure it meets the description shown in the documentation for this command.`
72+
);
73+
this.ux.error(this.statics.description);
74+
return;
75+
}
76+
6777
const authInfo = await AuthInfo.create({ oauth2Options });
6878
await authInfo.save();
6979

0 commit comments

Comments
 (0)