diff --git a/src/Exception/ExceptionFactory.php b/src/Exception/ExceptionFactory.php index 121f4a9..39f8a9f 100644 --- a/src/Exception/ExceptionFactory.php +++ b/src/Exception/ExceptionFactory.php @@ -21,7 +21,7 @@ public static function generateFromRequestException(RequestException $e) throw static::createDefaultException($e); } - $message = array_key_exists('message', $error) ? $error['message'] : $e->getMessage(); + $message = static::generateErrorMessage($error, $e); switch ($error['errorCode']) { case 'DUPLICATES_DETECTED': @@ -39,6 +39,14 @@ public static function generateFromRequestException(RequestException $e) } } + private static function generateErrorMessage(array $error, RequestException $e) + { + $message = array_key_exists('message', $error) ? $error['message'] : $e->getMessage(); + $message .= "\nRequest: ".$e->getRequest()->getUri(); + + return $message; + } + private static function createDefaultException(RequestException $e) { return new SalesforceClientException($e->getMessage(), 0, $e);