Skip to content

Commit

Permalink
fix: optional orgs can be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Apr 7, 2022
1 parent 783013b commit 412629d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/flags/orgFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { Messages, Org, ConfigAggregator } from '@salesforce/core';
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/sf-plugins-core', 'messages');

const maybeGetOrg = async (input?: string): Promise<Org | undefined> => Org.create({ aliasOrUsername: input });
const maybeGetOrg = async (input?: string): Promise<Org | undefined> =>
input ? Org.create({ aliasOrUsername: input }) : undefined;

const getOrgOrThrow = async (input?: string): Promise<Org> => {
const org = await maybeGetOrg(input);
if (!org) {
Expand Down

0 comments on commit 412629d

Please sign in to comment.