I'm plotting addresses on google maps. There are 2 cases I have to catch. One is if it is going to fast google returns a 503. If there is a 503 I have to pause and then try again.
The other exception is if there is a wrong address somewhere or something missing that google can't find it. In this 2nd case I don't know if I should print the wrong address to the browser because it would mess up the map with errors. Should I print the wrong address to a log so the user can correct it? The $addrErrors[] should take the associative $addArray address to save the address for some kind of output to the user. I don't know if I did that right.
Here is the code:
foreach($addrArray as $key => $value){
try{
$map->addAddress($value);
$pointer = $map->addAddress($value);
switch{
case(strpos($pointer,"Service Unavailable")):
throw exception503("503 Service Unavailable");
break;
case (strpos($pointer, "Undefined offset: 3")):
throw exceptionOffset("");
break;
}
catch ("exception503")
{
pause(1700);
$map->addAddress($value);
echo "Please be patient while Google geocodes.";
}
catch ("exceptionOffset")
{
echo "There is an error in this address, please correct.";
$addressErrors[]= $addrArray;
}
$map->printGoogleJS();
}
thanks,