/** * Turns a ClientException into a CtctException - like magic. * @param ClientException $exception - Guzzle ClientException * @return CtctException */ protected function convertException($exception) { $ctctException = new CtctException($exception->getResponse()->getReasonPhrase(), $exception->getCode()); $ctctException->setUrl($exception->getResponse()->getEffectiveUrl()); $ctctException->setErrors(json_decode($exception->getResponse()->getBody()->getContents())); return $ctctException; }