@@ -99,7 +99,7 @@ export class AMQPClient extends AMQPBaseClient {
9999 // first 7 bytes of a frame was split over two reads, this reads the second part
100100 if ( this . framePos !== 0 ) {
101101 const copied = buf . copy ( this . frameBuffer , this . framePos , bufPos , bufPos + 7 - this . framePos )
102- if ( copied === 0 ) throw `Copied 0 bytes framePos=${ this . framePos } bufPos=${ bufPos } bytesWritten=${ bufLen } `
102+ if ( copied === 0 ) throw new AMQPError ( `Copied 0 bytes framePos=${ this . framePos } bufPos=${ bufPos } bytesWritten=${ bufLen } ` , this )
103103 this . frameSize = this . frameBuffer . readInt32BE ( bufPos + 3 ) + 8
104104 this . framePos += copied
105105 bufPos += copied
@@ -108,7 +108,7 @@ export class AMQPClient extends AMQPBaseClient {
108108 // frame header is split over reads, copy to frameBuffer
109109 if ( bufPos + 3 + 4 > bufLen ) {
110110 const copied = buf . copy ( this . frameBuffer , this . framePos , bufPos , bufLen )
111- if ( copied === 0 ) throw `Copied 0 bytes framePos=${ this . framePos } bufPos=${ bufPos } bytesWritten=${ bufLen } `
111+ if ( copied === 0 ) throw new AMQPError ( `Copied 0 bytes framePos=${ this . framePos } bufPos=${ bufPos } bytesWritten=${ bufLen } ` , this )
112112 this . framePos += copied
113113 break
114114 }
@@ -128,7 +128,7 @@ export class AMQPClient extends AMQPBaseClient {
128128 const leftOfFrame = this . frameSize - this . framePos
129129 const copyBytes = Math . min ( leftOfFrame , bufLen - bufPos )
130130 const copied = buf . copy ( this . frameBuffer , this . framePos , bufPos , bufPos + copyBytes )
131- if ( copied === 0 ) throw `Copied 0 bytes, please report this bug, frameSize=${ this . frameSize } framePos=${ this . framePos } bufPos=${ bufPos } copyBytes=${ copyBytes } bytesWritten=${ bufLen } `
131+ if ( copied === 0 ) throw new AMQPError ( `Copied 0 bytes, please report this bug, frameSize=${ this . frameSize } framePos=${ this . framePos } bufPos=${ bufPos } copyBytes=${ copyBytes } bytesWritten=${ bufLen } ` , this )
132132 this . framePos += copied
133133 bufPos += copied
134134 if ( this . framePos === this . frameSize ) {
0 commit comments