Skip to content

Commit

Permalink
IT-10656 Refactored catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
gecbla committed Jun 1, 2023
1 parent 05df487 commit 923aa3b
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Arbor/Api/Gateway/RestGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,11 @@ public function bulkCreate(string $resource, Collection $collection, bool $check
$options['body']['request'][] = [$resourceRoot => $arrayRepresentation];
}

$exception = null;

try {
$responseRepresentation = $this->sendRequest(self::HTTP_METHOD_POST, "/rest-v2/$resourceUrl", $options);
} catch (ServerErrorException $exception) {
$responseRepresentation = $exception->getResponsePayload();
}

if (isset($exception)) {
$failedResponses = array_reduce($responseRepresentation['results'] ?? [], static function ($responses, $item) {
if (isset($item['status']) && $item['status']['success'] === false) {
$responses[] = $item['status'];
Expand Down

0 comments on commit 923aa3b

Please sign in to comment.