|
@@ -12,6 +12,7 @@ namespace Luticate\Utils\DataAccess;
|
12
|
12
|
use GuzzleHttp\Client;
|
13
|
13
|
use GuzzleHttp\Exception\ClientException;
|
14
|
14
|
use GuzzleHttp\Exception\RequestException;
|
|
15
|
+use Luticate\Utils\Business\LuBusinessException;
|
15
|
16
|
use Luticate\Utils\Business\LuLog;
|
16
|
17
|
use Luticate\Utils\Dbo\LuRequestDbo;
|
17
|
18
|
|
|
@@ -51,6 +52,9 @@ class LuRequest
|
51
|
52
|
}
|
52
|
53
|
if (!is_null($response)) {
|
53
|
54
|
$body = json_decode($response->getBody(), true);
|
|
55
|
+ /**
|
|
56
|
+ * @var $request LuRequestDbo
|
|
57
|
+ */
|
54
|
58
|
$request = LuRequestDbo::jsonDeserialize($body);
|
55
|
59
|
$request->setStatusCode($response->getStatusCode());
|
56
|
60
|
return $request;
|
|
@@ -65,7 +69,7 @@ class LuRequest
|
65
|
69
|
{
|
66
|
70
|
$response = LuRequest::request($method, $url, $get, $post, $headers);
|
67
|
71
|
if ($response->getStatusCode() != 200) {
|
68
|
|
- abort($response->getStatusCode(), $response->getMessage());
|
|
72
|
+ throw new LuBusinessException($response->getMessage(), $response->getStatusCode());
|
69
|
73
|
}
|
70
|
74
|
return $response->getData();
|
71
|
75
|
}
|