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

Function errorMatches

test/unit/static/js/assertions.js:124–135  ·  view source on GitHub ↗
(actual, expected)

Source from the content-addressed store, hash-verified

122
123 // Utility for checking whether an error matches a given constructor, regexp or string
124 function errorMatches (actual, expected) {
125 if (typeof expected === 'string') {
126 return actual.message === expected;
127 }
128 if (expected instanceof RegExp) {
129 return expected.test(actual.message);
130 }
131 if (actual instanceof expected) {
132 return true;
133 }
134 return false;
135 }
136
137 function AssertionError (opts) {
138 opts = opts || {};

Callers 1

functionThrowsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected