Hi @Eneris, it's me again!
In the #clearReady() function there is this:
if (!this.#ready.isResolved) {
this.#ready.reject(new Error('Client destroyed'))
}
However, this creates an unhandled rejection which crashes NodeJS. I can't figure out any way that I can reliably catch this as a consumer, other than implementing a global handler, which is not ideal. I can attach a handler to whenReady prior to calling connect, however, this is recreated on the retry, so it only works once and subsequent retries still cause the error.
I think the simple fix is to modify defer to simply catch rejections and log errors, but I'm not sure of your preferred behavior.
Hi @Eneris, it's me again!
In the
#clearReady()function there is this:However, this creates an unhandled rejection which crashes NodeJS. I can't figure out any way that I can reliably catch this as a consumer, other than implementing a global handler, which is not ideal. I can attach a handler to whenReady prior to calling connect, however, this is recreated on the retry, so it only works once and subsequent retries still cause the error.
I think the simple fix is to modify defer to simply catch rejections and log errors, but I'm not sure of your preferred behavior.