Ideally this should return the string returned by google as to WHY it failed, but the following is far better than silence.

diff -r 917ae7c81790 location/geocoding/google.inc
--- a/location/geocoding/google.inc     Mon Sep 27 20:05:31 2010 -0400
+++ b/location/geocoding/google.inc     Tue Sep 28 13:55:26 2010 -0400
@@ -130,6 +130,7 @@
   preg_match('/<code>(.*)<\/code>/', $http_reply->data, $status_code_match);
   $status_code = $status_code_match[1];
   if ($status_code != 200) {
+    watchdog('location', t('Google geocoding returned: %status_code', array('%status_code' => $status_code)));
     return NULL;
   }
 
@@ -137,6 +138,7 @@
   preg_match('/Accuracy="([0-9])"/', $http_reply->data, $accuracy_code_match);
   $accuracy_code = $accuracy_code_match[1];
   if ($accuracy_code < variable_get('location_geocode_' . $location['country'] . 'google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3'))) {
+    watchdog('location',t('Google geocoding accuracy: %accuracy_code', array('%accuracy_code' => $accuracy_code)));
     return NULL;
   }
CommentFileSizeAuthor
#2 location_925480.patch1.15 KBtobiasb
google.inc_.patch2.08 KBDanGarthwaite
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sethcohn’s picture

+1

tobiasb’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.15 KB
rooby’s picture

Status: Reviewed & tested by the community » Fixed

@tobiasb:
When setting issues to RTBC it is good to give some sort of comment like that you have tested it (and how you tested it if it is not obvious) and it works or something. Especially if no one else has commented anything along those lines.
Also, when adding a new patch you should say why. How it is different from the patches before.

I have committed a slightly modified version of the patch to all versions.
Changes I made were:
* Removed t() from the watchdog() calls as watchdog handles that itself (except for in drupal 5).
* Changed the accuracy message to make it more useful.
* Added the changes to location_geocode_au_google() in location.au.inc also. Geocoding functionalities can be overridden per country in these include files. In this case the only country that has code relevant to this patch was Australia.

http://drupal.org/cvs?commit=473176
http://drupal.org/cvs?commit=473168
http://drupal.org/cvs?commit=473172

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.