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

Function hasMatchingError

lib/assert.js:675–693  ·  view source on GitHub ↗
(actual, expected)

Source from the content-addressed store, hash-verified

673}
674
675function hasMatchingError(actual, expected) {
676 if (typeof expected !== 'function') {
677 if (isRegExp(expected)) {
678 const str = String(actual);
679 return RegExpPrototypeExec(expected, str) !== null;
680 }
681 throw new ERR_INVALID_ARG_TYPE(
682 'expected', ['Function', 'RegExp'], expected,
683 );
684 }
685 // Guard instanceof against arrow functions as they don't have a prototype.
686 if (expected.prototype !== undefined && actual instanceof expected) {
687 return true;
688 }
689 if (ObjectPrototypeIsPrototypeOf(Error, expected)) {
690 return false;
691 }
692 return FunctionPrototypeCall(expected, {}, actual) === true;
693}
694
695function expectsNoError(stackStartFn, actual, error, message) {
696 if (actual === NO_EXCEPTION_SENTINEL)

Callers 1

expectsNoErrorFunction · 0.85

Calls 1

StringClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…