File tree 1 file changed +13
-14
lines changed
1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change 9
9
use Lodestone \Parser \Parser ;
10
10
use Ramsey \Uuid \Uuid ;
11
11
use Symfony \Component \HttpClient \CurlHttpClient ;
12
+ use Symfony \Component \HttpClient \Exception \ClientException ;
12
13
13
14
class Http
14
15
{
@@ -111,24 +112,22 @@ public function settle()
111
112
112
113
// grab request id
113
114
$ requestId = $ userdata ['request_id ' ];
114
-
115
- // if it wasn't a 200, return error
116
- if ($ response ->getStatusCode () != 200 ) {
117
- $ content [$ requestId ] = (Object )[
118
- 'Error ' => true ,
119
- 'StatusCode ' => $ response ->getStatusCode ()
120
- ];
121
- continue ;
122
- }
123
-
115
+
124
116
// grab the parser class name
125
117
/** @var Parser $parser */
126
118
$ parser = new $ userdata ['parser ' ]($ userdata );
127
119
128
- // handle response
129
- $ content [$ requestId ] = $ parser ->handle (
130
- $ response ->getContent ()
131
- );
120
+ try {
121
+ // handle response
122
+ $ content [$ requestId ] = $ parser ->handle (
123
+ $ response ->getContent ()
124
+ );
125
+ } catch (ClientException $ ex ) {
126
+ $ content [$ requestId ] = (Object )[
127
+ 'Error ' => true ,
128
+ 'StatusCode ' => $ ex ->getCode ()
129
+ ];
130
+ }
132
131
}
133
132
}
134
133
You can’t perform that action at this time.
0 commit comments