I think the API is automatically handling the errors and leaving them blanked, no? (would help if you shared a screenshot of the error) - But anyway if what you meant is to catch such errors (exceptions) here is the list of all possible exceptions in Geocodio (source):
An HTTP 403 error raises a GeocodioAuthError
An HTTP 422 error raises a GeocodioDataError and the error message will be reported through the exception
An HTTP 5xx error raises a GeocodioServerError
An unmatched non-200 response will simply raise Exception
In your case, for a non processable address you should catch the GeocodioDataError
exception. Buy anyway it's a good practice to catch all the supported ones (Catch 'Em All). I guess you should be able to do something like this:
try
{
$location = $client->post($AddressData);
}
catch(\Stanley\Geocodio\GeocodioAuthError)
{
// do something
}
catch(\Stanley\Geocodio\GeocodioDataError)
{
// do something
}
catch(\Stanley\Geocodio\GeocodioServerError)
{
// do something
}
catch (\Exception $e)
{
// do something
}
In the attached screenshot I see you are using Guzzle
! In Guzzle
you can catch exceptions like this (more read):
try
{
$location = $client->post($AddressData);
}
catch (Guzzle\Http\Exception\BadResponseException $e)
{
// do something
}