Skip to content

Commit

Permalink
fix: add the original error stack to the new error
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed Nov 15, 2023
1 parent 498ccfd commit 0cf2ef7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/commands/org/login/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ export default class LoginWeb extends AuthBaseCommand<AuthFields> {
return fields;
} catch (err) {
const error = err as Error;
Logger.childFromRoot('auth').debug(error);
Logger.childFromRoot('LoginWebCommand').debug(error);
if (error.name === 'AuthCodeExchangeError') {
throw new SfError(messages.getMessage('invalidClientId', [error.message]));
const authError = new SfError(messages.getMessage('invalidClientId', [error.message]));
if (error.stack) {
authError.stack += `\nDUE TO:\n${error.stack}`;
}
throw authError;
}
throw error;
}
Expand Down

0 comments on commit 0cf2ef7

Please sign in to comment.