Skip to content

Commit

Permalink
throwable
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkitjalan committed Oct 10, 2024
1 parent 47978cc commit d4e1cf2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Drivers/IPInfoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PulkitJalan\IPGeolocation\Drivers;

use Throwable;
use Illuminate\Support\Arr;
use GuzzleHttp\Client as GuzzleClient;
use PulkitJalan\IPGeolocation\Exceptions\InvalidCredentialsException;
Expand Down Expand Up @@ -63,7 +64,7 @@ public function getRaw($ip)
$response = $this->guzzle->get($url);

return json_decode($response->getBody(), true);
} catch (\Exception $e) {
} catch (Throwable $e) {
return [];
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/IPGeolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PulkitJalan\IPGeolocation;

use Throwable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use GuzzleHttp\Client as GuzzleClient;
Expand Down Expand Up @@ -126,7 +127,7 @@ public function getRaw()
if (! $data) {
try {
$data = $this->getDriver()->getRaw($ip);
} catch (\Exception $e) {
} catch (Throwable $e) {
throw new IPGeolocationException('Failed to get raw ip geolocation data', 0, $e);
}

Expand Down Expand Up @@ -155,7 +156,7 @@ protected function getData()
if (! $data) {
try {
$data = $this->getDriver()->get($ip);
} catch (\Exception $e) {
} catch (Throwable $e) {
throw new IPGeolocationException('Failed to get ip geolocation data', 0, $e);
}

Expand Down
4 changes: 2 additions & 2 deletions src/IPGeolocationUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PulkitJalan\IPGeolocation;

use PharData;
use Exception;
use Throwable;
use Illuminate\Support\Arr;
use GuzzleHttp\Client as GuzzleClient;
use PulkitJalan\IPGeolocation\Exceptions\InvalidDatabaseException;
Expand Down Expand Up @@ -93,7 +93,7 @@ protected function updateMaxmindDatabase()

array_map(fn ($file) => $this->removeIfExists($file), glob("$dir/*.*"));
@rmdir($dir);
} catch (Exception $e) {
} catch (Throwable $e) {
return false;
}

Expand Down

0 comments on commit d4e1cf2

Please sign in to comment.