Skip to content

Commit

Permalink
Overload handling
Browse files Browse the repository at this point in the history
  • Loading branch information
eskrano authored Jun 5, 2019
1 parent 99778ea commit 2025532
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ protected function exec(){
$contents=$e->getResponse()->getBody()->getContents();

$temp=json_decode($contents,true);

if (preg_match('/overload/i', $temp['error']['message'])) {
$this->auth();
try {
return json_decode($this->send(),true);
} catch (RequestException $e) {
throw new Exception($temp);
}
}

if(!empty($temp)) {
$temp['_method']=$this->type;
$temp['_url']=$this->host.$this->path;
Expand All @@ -133,4 +143,4 @@ protected function exec(){
throw new Exception(json_encode($temp));
}
}
}
}

0 comments on commit 2025532

Please sign in to comment.