We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9a3814 commit 990c46cCopy full SHA for 990c46c
1 file changed
src/amqp-channel.ts
@@ -766,6 +766,7 @@ export class AMQPChannel {
766
* @param [err] - why the channel was closed
767
*/
768
setClosed(err?: Error): void {
769
+ const closedByServer = err !== undefined
770
err ||= new Error("Connection closed by client")
771
if (!this.closed) {
772
this.closed = true
@@ -776,10 +777,7 @@ export class AMQPChannel {
776
777
this.unconfirmedPublishes.forEach(([, , reject]) => reject(err))
778
this.unconfirmedPublishes.length = 0
779
- // Call onerror for any error, whether from server or from a channel operation
780
- if (err.message !== "Connection closed by client") {
781
- this.onerror(err.message)
782
- }
+ if (closedByServer) this.onerror(err.message)
783
}
784
785
0 commit comments