Closed tsolar closed 10 years ago
That code should work. Is it possible that you have an exception class in your namespace called Exception
? You could try changing catch (Exception $e)
to catch (\Exception $e)
.
As a best practice, I would suggest catching GeoIp2\Exception\AddressNotFoundException
specifically rather than trying to catch all exceptions.
Wow, I was focused only in Exception
, and I completely forgot to escape it from current namespace.
I had an if clause inside the catch to manage GeoIp2\Exception\AddressNotFoundException
, that was my mistake, because it provoked me to unfocus in Exception
.
Thank you very much!! You made my day :smiley:
Hi guys,
I've been trying by infinite ways to catch this exception.
The exception comes from https://github.com/maxmind/GeoIP2-php/blob/master/src/GeoIp2/Database/Reader.php#L167
This is not catching the exception:
I've tried a lot of things, but anything works.... :( However, this simple try codeblock I pasted above should work, right?
Am I doing anything wrong? How can I catch that exception?