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

Function E

lib/internal/errors.js:555–586  ·  view source on GitHub ↗
(sym, val, def, ...otherClasses)

Source from the content-addressed store, hash-verified

553// Utility function for registering the error codes. Only used here. Exported
554// *only* to allow for testing.
555function E(sym, val, def, ...otherClasses) {
556 // Special case for SystemError that formats the error message differently
557 // The SystemErrors only have SystemError as their base classes.
558 messages.set(sym, val);
559
560 const ErrClass = def === SystemError ?
561 makeSystemErrorWithCode(sym) :
562 makeNodeErrorWithCode(def, sym);
563
564 if (otherClasses.length !== 0) {
565 if (otherClasses.includes(HideStackFramesError)) {
566 if (otherClasses.length !== 1) {
567 otherClasses.forEach((clazz) => {
568 if (clazz !== HideStackFramesError) {
569 ErrClass[clazz.name] = makeNodeErrorWithCode(clazz, sym);
570 ErrClass[clazz.name].HideStackFramesError = makeNodeErrorForHideStackFrame(ErrClass[clazz.name], clazz);
571 }
572 });
573 }
574 } else {
575 otherClasses.forEach((clazz) => {
576 ErrClass[clazz.name] = makeNodeErrorWithCode(clazz, sym);
577 });
578 }
579 }
580
581 if (otherClasses.includes(HideStackFramesError)) {
582 ErrClass.HideStackFramesError = makeNodeErrorForHideStackFrame(ErrClass, def);
583 }
584
585 codes[sym] = ErrClass;
586}
587
588function getExpectedArgumentLength(msg) {
589 let expectedLength = 0;

Callers 1

errors.jsFile · 0.70

Calls 6

makeSystemErrorWithCodeFunction · 0.85
makeNodeErrorWithCodeFunction · 0.85
includesMethod · 0.80
forEachMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected