function assertThrows(expected, throws, opt_message) {
  try {
    throws.call();
  } catch (err) {
    if (err.message.includes(expected)) {
      return;
    }
    throw new Error(opt_message || `Expected: '${expected}', got: '${err}'`);
  }
  throw new Error(opt_message || 'Got no error.');
}
/**
 * Aborts a test if the |throws| function does not throw an error,
 * or the error message does not contain |expected|.
 * @param {!string} expected The expected error message substring.
 * @param {!Function} throws The function that should throw an error with
 *    a message containing |expected| as a substring.
 * @param {string=} opt_message A message to log if this assertion fails.
 */
Aborts a test if the |throws| function does not throw an error,
or the error message does not contain |expected|.
@param {!string} expected The expected error message substring.
@param {!Function} throws The function that should throw an error with
a message containing |expected| as a substring.
@param {string=} opt_message A message to log if this assertion fails.
Aborts a test if the |throws| function does not throw an error or the error message does not contain |expected| . @param { !string } expected The expected error message substring . @param { !Function } throws The function that should throw an error with a message containing |expected| as a substring . @param { string = } opt_message A message to log if this assertion fails .
function assertThrows(expected, throws, opt_message) {
  try {
    throws.call();
  } catch (err) {
    if (err.message.includes(expected)) {
      return;
    }
    throw new Error(opt_message || `Expected: '${expected}', got: '${err}'`);
  }
  throw new Error(opt_message || 'Got no error.');
}
function assertThrows ( expected , throws , opt_message ) { try { throws . call ( ) ; } catch ( err ) { if ( err . message . includes ( expected ) ) { return ; } throw new Error ( opt_message || ` ${ expected } ${ err } ` ) ; } throw new Error ( opt_message || 'Got no error.' ) ; }
Aborts a test if the |throws| function does not throw an error,
 or the error message does not contain |expected|.
Aborts a test if the |throws| function does not throw an error or the error message does not contain |expected| .