B2G/gecko/image/test/unit/test_imgtools.js
/*
 * checkExpectedError
 *
 * Checks to see if a thrown error was expected or not, and if it
 * matches the expected value.
 */
checkExpectedError
Checks to see if a thrown error was expected or not, and if it
matches the expected value.
checkExpectedError Checks to see if a thrown error was expected or not and if it matches the expected value .
function checkExpectedError (aExpectedError, aActualError) {
  if (aExpectedError) {
      if (!aActualError)
          throw "Didn't throw as expected (" + aExpectedError + ")";
      if (!aExpectedError.test(aActualError))
          throw "Threw (" + aActualError + "), not (" + aExpectedError;
      dump("...that error was expected.\n\n");
  } else if (aActualError) {
      throw "Threw unexpected error: " + aActualError;
  }
}
function checkExpectedError ( aExpectedError , aActualError ) { if ( aExpectedError ) { if ( ! aActualError ) throw "Didn't throw as expected (" + aExpectedError + ")" ; if ( ! aExpectedError . test ( aActualError ) ) throw "Threw (" + aActualError + "), not (" + aExpectedError ; dump ( "...that error was expected.\n\n" ) ; } else if ( aActualError ) { throw "Threw unexpected error: " + aActualError ; } }
checkExpectedError
 Checks to see if a thrown error was expected or not, and if it
 matches the expected value.
checkExpectedError Checks to see if a thrown error was expected or not and if it matches the expected value .
// We got the expected error, so make a note in the test log.