MCPcopy Index your code
hub / github.com/nodejs/node / onerror

Function onerror

lib/internal/streams/readable.js:1037–1050  ·  view source on GitHub ↗
(er)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 6

unpipeFunction · 0.85
errorOrDestroyFunction · 0.85
listenerCountMethod · 0.80
debugFunction · 0.50
removeListenerMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected