You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pipeline(this.s3StreamReader.openStream(this.bucket,key),splitLine(line=>{try{returnJSON.parse(line.toString());}catch(error){thrownewTypeError(`line: "${line}" is not in json format`);}}),(error?)=>{if(!error){this.logger.debug(`done streaming file: '${this.bucket}/${key}'`);}else{this.logger.error(`error streaming file: '${this.bucket}/${key}', ${error}`);}}).on("error"(err)=>{this.logger("WILL NEVER BE CALLED")});
the on error will never be called.
fix suggestion to the transform function:
functiontransform(chunk,enc,cb){varlistif(this.overflow){// Line buffer is full. Skip to start of next line.varbuf=this[kDecoder].write(chunk)list=buf.split(this.matcher)if(list.length===1)returncb()// Line ending not found. Discard entire chunk.// Line ending found. Discard trailing fragment of previous line and reset overflow state.list.shift()this.overflow=false}else{this[kLast]+=this[kDecoder].write(chunk)list=this[kLast].split(this.matcher)}this[kLast]=list.pop()for(vari=0;i<list.length;i++){try{push(this,this.mapper(list[i]));}catch(error)cb(error)}this.overflow=this[kLast].length>this.maxLengthif(this.overflow&&!this.skipOverflow)returncb(newError('maximum buffer reached'))cb()}
basically wrapping the call with try/catch, on catch cb(error)
The text was updated successfully, but these errors were encountered:
example:
the on error will never be called.
fix suggestion to the transform function:
basically wrapping the call with try/catch, on catch cb(error)
The text was updated successfully, but these errors were encountered: