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

Function invokeOnerror

lib/internal/quic/quic.js:1202–1219  ·  view source on GitHub ↗

* Invoke an onerror callback. If the callback itself throws synchronously * or returns a promise that rejects, a SuppressedError wrapping both the * onerror failure and the original error is surfaced as an uncaught exception. * @param {Function} fn The onerror callback. * @param {any} error

(fn, error)

Source from the content-addressed store, hash-verified

1200 * @param {any} error The original error that triggered destruction.
1201 */
1202function invokeOnerror(fn, error) {
1203 try {
1204 const result = fn(error);
1205 if (isPromise(result)) {
1206 PromisePrototypeThen(result, undefined, (err) => {
1207 process.nextTick(() => {
1208 // eslint-disable-next-line no-restricted-syntax
1209 throw new SuppressedError(err, error, err?.message);
1210 });
1211 });
1212 }
1213 } catch (err) {
1214 process.nextTick(() => {
1215 // eslint-disable-next-line no-restricted-syntax
1216 throw new SuppressedError(err, error, err?.message);
1217 });
1218 }
1219}
1220
1221function validateBody(body) {
1222 if (body === undefined) return body;

Callers 2

destroyMethod · 0.85
destroyMethod · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…