function checkForError(jsonResponse, checkedField, errorMessage) {
	console.log("checkForError: " + JSON.stringify(jsonResponse));
	if (JSON.stringify(jsonResponse).indexOf(checkedField) == -1) {
		if (JSON.stringify(jsonResponse).indexOf("<h3>The resource you are looking for might have been removed") > -1) {
			jsonResponse = new Object()
			jsonResponse["message"] = "The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.";
			jsonResponse["status"] = 404;
		}
		else if (JSON.stringify(jsonResponse).indexOf("</b>An application error occurred on the server.") > -1) {
			jsonResponse = new Object()
			jsonResponse["message"] = "An application error occurred on the server.";
			jsonResponse["status"] = 500;
		}
		jsonResponse["error"] = errorMessage;
		throw new Error(JSON.stringify(jsonResponse));
	}
}
//Checks the response back from the API request to look for error
Checks the response back from the API request to look for error
Checks the response back from the API request to look for error
function checkForError(jsonResponse, checkedField, errorMessage) {
	console.log("checkForError: " + JSON.stringify(jsonResponse));
	if (JSON.stringify(jsonResponse).indexOf(checkedField) == -1) {
		if (JSON.stringify(jsonResponse).indexOf("<h3>The resource you are looking for might have been removed") > -1) {
			jsonResponse = new Object()
			jsonResponse["message"] = "The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.";
			jsonResponse["status"] = 404;
		}
		else if (JSON.stringify(jsonResponse).indexOf("</b>An application error occurred on the server.") > -1) {
			jsonResponse = new Object()
			jsonResponse["message"] = "An application error occurred on the server.";
			jsonResponse["status"] = 500;
		}
		jsonResponse["error"] = errorMessage;
		throw new Error(JSON.stringify(jsonResponse));
	}
}
function checkForError ( jsonResponse , checkedField , errorMessage ) { console . log ( "checkForError: " + JSON . stringify ( jsonResponse ) ) ; if ( JSON . stringify ( jsonResponse ) . indexOf ( checkedField ) == - 1 ) { if ( JSON . stringify ( jsonResponse ) . indexOf ( "<h3>The resource you are looking for might have been removed" ) > - 1 ) { jsonResponse = new Object ( ) jsonResponse [ "message" ] = "The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable." ; jsonResponse [ "status" ] = 404 ; } else if ( JSON . stringify ( jsonResponse ) . indexOf ( "</b>An application error occurred on the server." ) > - 1 ) { jsonResponse = new Object ( ) jsonResponse [ "message" ] = "An application error occurred on the server." ; jsonResponse [ "status" ] = 500 ; } jsonResponse [ "error" ] = errorMessage ; throw new Error ( JSON . stringify ( jsonResponse ) ) ; } }
Checks the response back from the API request to look for error
Checks the response back from the API request to look for error