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

instanceof check for "ActorCallError"/"QueryCallRejectedError"/"UpdateCallRejectedError" #907

Open
alexeychirkov opened this issue Jul 19, 2024 · 0 comments · May be fixed by #908
Open

Comments

@alexeychirkov
Copy link

Hey!

Is it intentional that the implementations of the ActorCallError, QueryCallRejectedError, and UpdateCallRejectedError classes do not use Object.setPrototypeOf?

The issue is that it currently prevents a type-safe check for an error thrown using this code:

try {
   myActor.notFoundQueryMethod();
} catch(e) {
   if (e instanceof QueryCallRejectedError) {
      // profit!
   }
}

The only type-safe check that works now is e instanceof AgentError, which is useless because AgentError has no properties to check.

@krpeacock krpeacock linked a pull request Jul 22, 2024 that will close this issue
4 tasks
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 a pull request may close this issue.

1 participant