MCPcopy Index your code
hub / github.com/prototypejs/prototype / errorMatches

Function errorMatches

test/unit/static/js/proclaim.js:495–506  ·  view source on GitHub ↗
(actual, expected)

Source from the content-addressed store, hash-verified

493
494 // Utility for checking whether an error matches a given constructor, regexp or string
495 function errorMatches (actual, expected) {
496 if (typeof expected === 'string') {
497 return actual.message === expected;
498 }
499 if (expected instanceof RegExp) {
500 return expected.test(actual.message);
501 }
502 if (actual instanceof expected) {
503 return true;
504 }
505 return false;
506 }
507
508
509 // Exports

Callers 1

functionThrowsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected