Geocoder icon indicating copy to clipboard operation
Geocoder copied to clipboard

Equivalent to NoResult Exception when updating from older versions

Open VikitorGalevez opened this issue 2 years ago • 2 comments

Hi, im updating my project and i came across this problem. I have some uses for Geocoder\Exception\NoResult, but those no longer exist. Are there any equivalents? Or should i use the generic exception for this cases?

VikitorGalevez avatar Apr 25 '23 11:04 VikitorGalevez

Hello @VikitorGalevez,

I must admit I don't remember that NoResult exception ; it was probably from a version before I joined the project.

But I think you could migrate that exception catch to the isEmpty() function in AddressCollection class (see AddressCollection.php).

jbelien avatar Apr 26 '23 06:04 jbelien

The thing is we have different exceptions thrown if some conditions are met, for example in this case: if(empty($content)) { throw new NoResult(sprintf('Could not execute query "%s".', $query)); }

I was just thinking of using the normal exception. How would you use the addressCollection in this case?

VikitorGalevez avatar Apr 26 '23 08:04 VikitorGalevez