Skip to content

Commit

Permalink
fix: per peter feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 4, 2021
1 parent ea72d9f commit e0c366a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,12 @@ export class Connection extends JSForceConnection {
): Promise<T> {
const result = options.tooling ? await this.tooling.query<T>(soql) : await this.query<T>(soql);
if (result.totalSize === 0) {
throw new SfdxError(`No records found for ${soql}`, SingleRecordQueryErrors.NoRecords);
throw new SfdxError(`No record found for ${soql}`, SingleRecordQueryErrors.NoRecords);
}
if (result.totalSize > 1) {
throw new SfdxError(
options.returnChoicesOnMultiple && options.choiceField
? `Multiple records found. ${result.records
.map((item) => item[(options.choiceField ?? 'Name') as keyof T])
.join(',')}`
? `Multiple records found. ${result.records.map((item) => item[options.choiceField as keyof T]).join(',')}`
: 'The query returned more than 1 record',
SingleRecordQueryErrors.MultipleRecords
);
Expand Down

0 comments on commit e0c366a

Please sign in to comment.