Skip to content

Commit

Permalink
新增网络请求错误抛出异常
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Feb 28, 2020
1 parent 1574de2 commit 5d7b2e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public function execute($params, $format = 'JSON')
$this->prepareExecute($params, $url, $data);
$this->url = $url;
$this->response = $this->http->send($url, $this->requestData, $params->_method);
if(!$this->response->success)
{
throw new \RuntimeException(sprintf('Request error: [%s] %s', $this->response->errno(), $this->response->error()));
}
switch($format)
{
case 'JSON':
Expand Down

0 comments on commit 5d7b2e8

Please sign in to comment.