/**
  * Gets the exception message.
  *
  * @param \Exception $ex
  * @return string
  */
 private function getExceptionMessage(\Exception $ex)
 {
     if ($ex instanceof RequestException && $ex->hasResponse()) {
         $res = (string) $ex->getResponse()->getBody();
         json_decode($res);
         if (json_last_error() === JSON_ERROR_NONE) {
             return $res;
         }
     }
     return $ex->getMessage();
 }
 /**
  * Gets the exception message.
  *
  * @param \Exception $ex
  * @return string
  */
 private function getExceptionMessage(\Exception $ex)
 {
     if ($ex instanceof RequestException && $ex->hasResponse()) {
         return (string) $ex->getResponse()->getBody();
     }
     return $ex->getMessage();
 }