Skip to content

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

@alexeychirkov

Description

@alexeychirkov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions