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

Add findEntity to complement getEntity #284

Closed
aiwilliams opened this issue Aug 11, 2020 · 1 comment
Closed

Add findEntity to complement getEntity #284

aiwilliams opened this issue Aug 11, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@aiwilliams
Copy link
Contributor

getEntity throws an error when the entity is not found. This may force the developer to code this pattern:

let entity: Entity;
try {
  entity = await jobState.getEntity(...);
} catch (err) {
  entity = null;
}

When the entity is expected to possibly be not found, it is more expressive and less code to write:

  const entity = await jobState.findEntity(...);
@aiwilliams aiwilliams added the enhancement New feature or request label Aug 11, 2020
@austinkelleher
Copy link
Contributor

Super agree. I was thinking the same thing when I used it.

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

No branches or pull requests

2 participants