There's a bug when trying to geocode an invalid address, or at least when Google doesn't return any results, it spits out this nice "Error geocoding - ZERO_RESULTS" error message at the top of the screen.
It looks like this is happening in geooder/plugins/geocode_handler/google.inc on lines 38 and 106.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | geocoder-use-watchdog-to-log-messages-1617876-17.patch | 6.91 KB | Dean Reilly |
| #12 | geocoder-use-watchdog-to-log-messages-1617876-12.patch | 3.42 KB | Dean Reilly |
Comments
Comment #1
phayes commentedIf it said "Error geocoding - No results", would that be better?
What do you want to see happen?
Comment #2
iwhitcomb commentedI don't think it shouldn't say anything to be honest, not to the end user.
Comment #3
mnlund commentedAgree! This could be shown for privileged users.
Comment #4
rooby commentedI agree. In my case I am using this module as an API and calling the geocoding functions from elsewhere.
In the case of an error like ZERO_RESULTS, I use a default value for the location in the backend and don't want any messages displayed on the screen for the error.
Maybe if it were a setting you could enable / disable the error messages?
A wrapper around drupal_set_message() that checks the value of a $debug variable or similar maybe?
I can manually remove the messages in my custom code but that isn't a good solution.
Comment #5
rooby commentedIt should log it to watchdog though I think. Or maybe that could be an option too :)
Comment #6
plopescHello
I'm working on this issue form Barcelona Drupal Dev Days sprint.
I think the biggest problem is that each geocoder displays its own errors.
That implies each plugin will manage the error messages.
In my opinion, will be aesier if all the geocoding plugins send the message to the geocoder module. Then, geocoder module could check the variable by itself and decide if the error message should displayed or not and stored in watchdog or not.
What do you think?
Regards.
Comment #7
plopescHello
I'm working on this issue form Barcelona Drupal Dev Days sprint.
I think the biggest problem is that each geocoder displays its own errors.
That implies each plugin will manage the error messages.
In my opinion, will be aesier if all the geocoding plugins send the message to the geocoder module. Then, geocoder module could check the variable by itself and decide if the error message should displayed or not and stored in watchdog or not.
What do you think?
Regards.
Comment #8
michaelfavia commentedThe main module should not have to know about individual plugins and their messages. If you want to show or hide all geocoding messages or all geocoding error messages then that's cool with me. You'll need to specify the type of message in your message callback like drupal set message does so you can selectively purge/log them.
Comment #9
phayes commentedOkay, I'm going to change it to throw PHP warning. That way it can be suppressed as wanted in admin settings.
Comment #10
phayes commentedOkay,
This is now fixed. Please re-open if you have problems or concerns
Comment #11
ptmkenny commentedI have the 2012-Jun-20 dev version of Geocoder installed; I cleared my cache and No Warning Messages are set to display under Development: Logging and Errors.
Although the PHP warnings from other modules on my site are not displayed, when logged in as an authenticated user I am still getting the "Error geocoding - ZERO_RESULTS" warning from Geocoder. Authenticated users have no Geocoder permissions. Is there something else I need to do to hide the ZERO_RESULTS message?
Thanks in advance for any help you can provide.
Comment #12
Dean Reilly commentedThere are still some other places were errors might be being thrown. I've attached a patch where I've changed all the ones I think shouldn't be seen by the end user to watchdog error messages so they can be suppressed if necessary.
I've left the drupal_set_message() call on line 278 of geocoder.module in:
As it seems this is intended for the end user.
Same with line 18 of plugins/geocoder_handler/exif.inc
I've also changed the trigger_error calls to use watchdog. I'm not sure if Drupal has a policy when trigger_error or watchdog should be used so if anyone more knowledgeable would suggest changing it back I'd be happy with that.
Comment #13
ptmkenny commentedI attempt to apply the patch against the latest dev version (2012-Jun-20):
Hunk #1 FAILED at 181.
Hunk #2 succeeded at 232 (offset -33 lines).
1 out of 2 hunks FAILED -- saving rejects to file geocoder.widget.inc.rej
Here is the content of the .rej file:
Comment #14
Dean Reilly commentedThis patch is against the current HEAD of the repository, not the dev release.
Comment #15
nedjoOpened #1660992: Current geocoder dev release doesn't contain latest code.
Comment #16
phayes commentedThis patch needs to be re-rolled against latest dev now. Sorry for the confusion folks
Comment #17
Dean Reilly commentedNo worries. Rerolled the patch and attached it below.
I've also made some more changes:
Comment #18
Dean Reilly commentedComment #19
phayes commentedLooks good. I've committed it.