(stream, state, sync, er, cb)
| 25289 | } |
| 25290 | |
| 25291 | function onwriteError(stream, state, sync, er, cb) { |
| 25292 | --state.pendingcb; |
| 25293 | |
| 25294 | if (sync) { |
| 25295 | // defer the callback if we are being called synchronously |
| 25296 | // to avoid piling up things on the stack |
| 25297 | pna.nextTick(cb, er); |
| 25298 | // this can emit finish, and it will always happen |
| 25299 | // after error |
| 25300 | pna.nextTick(finishMaybe, stream, state); |
| 25301 | stream._writableState.errorEmitted = true; |
| 25302 | stream.emit('error', er); |
| 25303 | } else { |
| 25304 | // the caller expect this to happen before if |
| 25305 | // it is async |
| 25306 | cb(er); |
| 25307 | stream._writableState.errorEmitted = true; |
| 25308 | stream.emit('error', er); |
| 25309 | // this can emit finish, but finish must |
| 25310 | // always follow error |
| 25311 | finishMaybe(stream, state); |
| 25312 | } |
| 25313 | } |
| 25314 | |
| 25315 | function onwriteStateUpdate(state) { |
| 25316 | state.writing = false; |
no test coverage detected