pipedrive
pipedrive copied to clipboard
Verbose info for logging exception reasons
HI :)
It would be great to show an additional reason for the error for quick debugging. Thanks
You are right but this seems like a breaking change. What's your proposal?
As a quick solution concatenate error message with additional error info. Official PipeDrive link on it: https://pipedrive.readme.io/docs/core-api-concepts-responses
/**
* Throws PipedriveException with message depending on content.
* @see https://pipedrive.readme.io/docs/core-api-concepts-responses
*
* @param \stdClass $content
*/
protected function throwPipedriveException($content)
{
if (!isset($content->error, $content->error_info)) {
throw new PipedriveException('Error unknown.');
}
$errorMessage = $content->error . '. Info: ' . $content->error_info;
throw new PipedriveException($errorMessage);
}