Skip to content

Commit 52c7462

Browse files
committed
Move logging to correct method
1 parent ef36d49 commit 52c7462

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Transport/ApiClient.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ public function send(PayloadInterface $payload, $token = null)
186186
$serializedPayload = $this->payloadSerializer->serialize($payload);
187187
$responseData = $this->doSend($payload->getMethod(), $serializedPayload, $token);
188188

189-
return $this->payloadResponseSerializer->deserialize($responseData, $payload->getResponseClass());
189+
$response = $this->payloadResponseSerializer->deserialize($responseData, $payload->getResponseClass());
190+
191+
if ($this->isLogNotOk() && !$response->isOk()) {
192+
error_log($response->getErrorExplanation());
193+
}
194+
195+
return $response;
190196
} catch (\Exception $e) {
191197
throw new SlackException(sprintf('Failed to send payload: %s', $e->getMessage()), null, $e);
192198
}
@@ -251,10 +257,6 @@ private function doSend($method, array $data, $token = null)
251257

252258
$this->eventDispatcher->dispatch(self::EVENT_RESPONSE, new ResponseEvent($responseData));
253259

254-
if ($this->isLogNotOk() && !$responseData->isOk()) {
255-
error_log($responseData->getErrorExplanation());
256-
}
257-
258260
return $responseData;
259261
} catch (\Exception $e) {
260262
throw new SlackException('Failed to process response from the Slack API', null, $e);

0 commit comments

Comments
 (0)