Skip to content
Jack Works edited this page Nov 18, 2020 · 1 revision

Error 0: Cannot find a running iterator with the given ID.

AsyncCallGenerator receives a request to execute next(), return() or throw() on the given iterator instance, but that instance was not found.

If the iterator is returned {done: true}, it will removed from the memory. Further request on this instance will throw this error.

Error 1: Only string can be the RPC method name

Symbols cannot be transferred to the remote side so you cannot use a symbol as your RPC method name.

AsyncCall({
    [Symbol.for("Don't do this")]() {}
}, { channel })

If you get this error accidentally, please check if well-known symbols are called on the AsyncCall instance.

Error 2: Do not call methods started with "rpc." directly.

According to the specification of JSON RPC, methods started with "rpc." are used internally.

Error 3: "then" method is called on the AsyncCall instance, please explicitly set thenable to true or false in the option.

Consider this code:

async function getRPC() {
    return AsyncCall(...)
}

According to the JS semantics, it will invoke the "then" method immediately on the returning instance which is unwanted in most scenarios.