From b12200fabc9c9e64ba2f4cb4afe983aa3489430a Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Fri, 20 Jun 2014 13:16:23 -0700 Subject: [PATCH] Update for "write after end" uncaught error. --- lib/streams/BaseRollingFileStream.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/streams/BaseRollingFileStream.js b/lib/streams/BaseRollingFileStream.js index 5f03615..26de2b0 100644 --- a/lib/streams/BaseRollingFileStream.js +++ b/lib/streams/BaseRollingFileStream.js @@ -48,7 +48,14 @@ BaseRollingFileStream.prototype._write = function(chunk, encoding, callback) { function writeTheChunk() { debug("writing the chunk to the underlying stream"); that.currentSize += chunk.length; - that.theStream.write(chunk, encoding, callback); + if(that.theStream.writeable) { + try { + that.theStream.write(chunk, encoding, callback); + } + catch (err){ + callback(); + } + } } debug("in _write");