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

Function onerror

lib/internal/tls/wrap.js:562–593  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

560}
561
562function onerror(err) {
563 const owner = this[owner_symbol];
564 debug('%s onerror %s had? %j',
565 (typeof owner._tlsOptions === 'object' && owner._tlsOptions !== null) ?
566 owner._tlsOptions.isServer ? 'server' : 'client' :
567 'unknown',
568 err, owner._hadError);
569
570 if (owner._hadError)
571 return;
572
573 owner._hadError = true;
574
575 // Destroy socket if error happened before handshake's finish
576 if (!owner._secureEstablished) {
577 // When handshake fails control is not yet released,
578 // so self._tlsError will return null instead of actual error
579
580 // Set closing the socket after emitting an event since the socket needs to
581 // be accessible when the `tlsClientError` event is emitted.
582 owner._closeAfterHandlingError = true;
583 owner.destroy(err);
584 } else if (owner._tlsOptions?.isServer &&
585 owner._rejectUnauthorized &&
586 /peer did not return a certificate/.test(err.message)) {
587 // Ignore server's authorization errors
588 owner.destroy();
589 } else {
590 // Emit error
591 owner._emitTLSError(err);
592 }
593}
594
595// Used by both client and server TLSSockets to start data flowing from _handle,
596// read(0) causes a StreamBase::ReadStart, via Socket._read.

Callers 15

processDataFunction · 0.50
box2d.jsFile · 0.50
finishFunction · 0.50
failFunction · 0.50
processDataFunction · 0.50
copy.jsFile · 0.50
finishFunction · 0.50
failFunction · 0.50
processDataFunction · 0.50
zlib.jsFile · 0.50
finishFunction · 0.50
failFunction · 0.50

Calls 3

debugFunction · 0.50
destroyMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…