(sym, val, def, ...otherClasses)
| 553 | // Utility function for registering the error codes. Only used here. Exported |
| 554 | // *only* to allow for testing. |
| 555 | function 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 | |
| 588 | function getExpectedArgumentLength(msg) { |
| 589 | let expectedLength = 0; |
no test coverage detected