diff --git a/src/ApiException.php b/src/ApiException.php new file mode 100644 index 0000000..ec83157 --- /dev/null +++ b/src/ApiException.php @@ -0,0 +1,10 @@ +code}]: {$this->message}\n"; + } + +} diff --git a/src/Client.php b/src/Client.php index bdadfc2..0e4fbd8 100644 --- a/src/Client.php +++ b/src/Client.php @@ -54,7 +54,7 @@ class Client{ if(in_array($status_code,[200,201,204])){ return json_decode($result); }else{ - throw new \Exception("API $status_code Code: ".$result); + throw new ApiException($result,$status_code); } }