Skip to content

Instantly share code, notes, and snippets.

Created March 9, 2009 15:11
What would you like to do?
* Checks that the given expression throws an exception of the expected type, with an optional message.
* @example raises( function() { return; }, "TypeError", "invalid property access raises TypeError exception" );
* @param Function expression
* @param String expected exception type
* @param String message (optional)
function raises(expression, expected, message) {
try {
push(false, expression(), expected, message);
} catch(ex) {
console.log(message,, ex);
push( == expected,, expected, message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment