Closed aullah closed 2 years ago
I've been able to successfully catch the exception by checking for both an Exception and Throwable, like so:
try {
$location = GoogleMaps::lookup('NG1 6FD')->one();
} catch (\Exception|\Throwable $e) {
$location = false;
}
Good catch, this was a typecasting error from the Craft 4 update. Thanks for reporting it!
It's now been fixed, update to v4.2.1 whenever you get a chance. 👍
Hi there,
There seems to be an issue with version 4.2.0 of the Google Maps plugin. When searching for certain postcodes (in the UK), the following error is returned:
Exception 'TypeError' with message 'Cannot assign null to property doublesecretagency\googlemaps\events\GeocodingEvent::$results of type array'
I believe this response is given to any response where a location cannot be found. The line of code I'm using (which can be used to replicate the issue) is
GoogleMaps::lookup('NG1 6FD')->one()
.I'm trying to catch the exception but it doesn't seem to catch either (perhaps something I need to look into further).
Thank you and kind regards, Arif.