Skip to content

Commit

Permalink
Update ExceptionFactory.php
Browse files Browse the repository at this point in the history
  • Loading branch information
stephpy authored Feb 6, 2018
1 parent 6cc09d2 commit 1b371b2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Exception/ExceptionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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);
Expand Down

0 comments on commit 1b371b2

Please sign in to comment.