Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/LooplineSystems/CloseIoApiWrapper/Library/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use LooplineSystems\CloseIoApiWrapper\CloseIoResponse;
use LooplineSystems\CloseIoApiWrapper\Library\Exception\BadApiRequestException;
use LooplineSystems\CloseIoApiWrapper\Library\Exception\UrlNotSetException;
use LooplineSystems\CloseIoApiWrapper\Library\Exception\ResourceNotFoundException;

class Curl
{
Expand Down Expand Up @@ -65,7 +66,12 @@ public function getResponse(CloseIoRequest $request)
$response = $this->execute($curlHandler);

if ($response->hasErrors()) {
throw new BadApiRequestException($response->getErrors());
if ($response->getReturnCode() === 404) {
throw new ResourceNotFoundException();
} else {
throw new BadApiRequestException($response->getErrors());
}

} else {
return $response;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ResourceNotFoundException extends \Exception
*/
public function __construct()
{
parent::__construct('Requested resource not found');
parent::__construct('404: Requested resource not found. You may also be using the wrong API key; at the time of'
. ' writing Close.IO gives a 404 instead of a 403 in this case.');
}
}