From 1cb5def51c3cf06e87f2a6029868ebe135f04161 Mon Sep 17 00:00:00 2001 From: Rodrigo Espinosa de los Monteros <1084688+RodEsp@users.noreply.github.com> Date: Mon, 15 Mar 2021 17:53:02 -0400 Subject: [PATCH] fix: improve error handling --- src/commands/auth/sfdxurl/store.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/auth/sfdxurl/store.ts b/src/commands/auth/sfdxurl/store.ts index 4c030f5d..47ab1c6e 100644 --- a/src/commands/auth/sfdxurl/store.ts +++ b/src/commands/auth/sfdxurl/store.ts @@ -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();