Commit b7caada 1 parent b48fe8d commit b7caada Copy full SHA for b7caada
File tree 2 files changed +16
-8
lines changed
2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,15 @@ public static function resolveHttpBy(Closure $callback): void
33
33
*/
34
34
public function process (Request $ request ): Fluent |false
35
35
{
36
- return rescue (fn () => new Fluent (
37
- $ this ->http ()
38
- ->throw ()
39
- ->acceptJson ()
40
- ->get ($ this ->url ($ request ->getIp ()))
41
- ->json ()
42
- ), false , false );
36
+ return rescue (function () use ($ request ) {
37
+ $ response = $ this ->http ()->acceptJson ()->get (
38
+ $ this ->url ($ request ->getIp ())
39
+ );
40
+
41
+ throw_if ($ response ->failed ());
42
+
43
+ return new Fluent ($ response ->json ());
44
+ }, false , false );
43
45
}
44
46
45
47
/**
Original file line number Diff line number Diff line change 15
15
use PharData ;
16
16
use PharFileInfo ;
17
17
use RecursiveIteratorIterator ;
18
+ use RuntimeException ;
18
19
use Stevebauman \Location \Position ;
19
20
use Stevebauman \Location \Request ;
20
21
@@ -38,10 +39,15 @@ public function update(Command $command): void
38
39
$ tarFileName = 'maxmind.tar.gz '
39
40
);
40
41
41
- Http::withOptions (['sink ' => $ tarFilePath ])-> throw ( )->get (
42
+ $ response = Http::withOptions (['sink ' => $ tarFilePath ])->get (
42
43
$ this ->getDatabaseUrl ()
43
44
);
44
45
46
+ throw_if (
47
+ $ response ->failed (),
48
+ new RuntimeException ('Failed to download MaxMind database. Response: ' .$ response ->body ())
49
+ );
50
+
45
51
$ archive = new PharData ($ tarFilePath );
46
52
47
53
$ file = $ this ->discoverDatabaseFile ($ archive );
You can’t perform that action at this time.
0 commit comments