Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add async to the method using setFindOptions() #10787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bindon
Copy link

@bindon bindon commented Mar 22, 2024

Description of change

  • Although the return type in TypeScript is Promise<>, it is not possible to catch as shown below (not promise return)
  • This is because 5 modified methods are set to sync.
// definition: Repository<IamOrganization>.exists(options?: FindManyOptions<IamOrganization> | undefined): Promise<boolean>
// expected error: Promise.reject(EntityPropertyNotFoundError)

// AS-IS(not working)
this.repository.exists({ select: 'not_exists' }).catch((error) => console.error);

// AS-IS(working)
try {
  this.repository.exists({ select: 'not_exists' });
} catch (error) {
  console.error(error);
}

// TO-BE(working)
this.repository.exists({ select: 'not_exists' }).catch((error) => console.error);
// or
try {
  await this.repository.exists({ select: 'not_exists' });
} catch (error) {
  console.error(error);
}

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000 - N/A
  • There are new or updated unit tests validating the change - N/A
  • Documentation has been updated to reflect this change - N/A
  • The new commits follow conventions explained in CONTRIBUTING.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant