maxmind / GeoIP2-php

PHP API for GeoIP2 webservice client and database reader
https://maxmind.github.io/GeoIP2-php/
Apache License 2.0
2.33k stars 276 forks source link

When an IP is not in the DB #76

Closed amirkoklan closed 8 years ago

amirkoklan commented 8 years ago

I'm just wondering why don't we return something more meaningful like a "FALSE" or "Error=>true" when an IP is not in the DB. (your webservice was doing the later one)

Like that on the other hand we can handle it better. here: https://github.com/maxmind/GeoIP2-php/blob/master/src/Database/Reader.php#L221

oschwald commented 8 years ago

I am not sure I understand the question. We throw a specific exception that can be caught when the IP is not in the database. This seems more meaningful than a false value when you are expecting an object back. You can always use MaxMind\Db\Reader directly if you want different behvior.