(er)
| 1035 | // If the dest has an error, then stop piping into it. |
| 1036 | // However, don't suppress the throwing behavior for this. |
| 1037 | function onerror(er) { |
| 1038 | debug('onerror', er); |
| 1039 | unpipe(); |
| 1040 | dest.removeListener('error', onerror); |
| 1041 | if (dest.listenerCount('error') === 0) { |
| 1042 | const s = dest._writableState || dest._readableState; |
| 1043 | if (s && !s.errorEmitted) { |
| 1044 | // User incorrectly emitted 'error' directly on the stream. |
| 1045 | errorOrDestroy(dest, er); |
| 1046 | } else { |
| 1047 | dest.emit('error', er); |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | // Make sure our error handler is attached before userland ones. |
| 1053 | prependListener(dest, 'error', onerror); |
nothing calls this directly
no test coverage detected