added error reporting to test js