blob: 1169b2c5f400a45553d5a2ebbe50b6b07d4c01bc (
plain)
1
2
3
4
5
6
7
8
9
10
|
function assertThrownErrorContains(thunk, substr) {
try {
thunk();
} catch (e) {
if (e.message.indexOf(substr) !== -1)
return;
throw new Error("Expected error containing " + substr + ", got " + e);
}
throw new Error("Expected error containing " + substr + ", no exception thrown");
}
|