@@ -69,15 +69,13 @@ discard block |
||
| 69 | 69 | try { |
| 70 | 70 | $response = $this->httpClient->post($uri, $formData); |
| 71 | 71 | $this->logger->debug('Got response back from Telegram, applying json_decode'); |
| 72 | - } |
|
| 73 | - catch (ClientException $e) { |
|
| 72 | + } catch (ClientException $e) { |
|
| 74 | 73 | $response = $e->getResponse(); |
| 75 | 74 | // It can happen that we have a network problem, in such case, we can't do nothing about it, so rethrow |
| 76 | 75 | if (empty($response)) { |
| 77 | 76 | throw $e; |
| 78 | 77 | } |
| 79 | - } |
|
| 80 | - finally { |
|
| 78 | + } finally { |
|
| 81 | 79 | return new TelegramRawData((string) $response->getBody(), $e); |
| 82 | 80 | } |
| 83 | 81 | } |
@@ -98,10 +96,11 @@ discard block |
||
| 98 | 96 | $deferred->resolve(new TelegramRawData((string) $response->getBody())); |
| 99 | 97 | }, |
| 100 | 98 | function (RequestException $exception) use ($deferred) { |
| 101 | - if (!empty($exception->getResponse()->getBody())) |
|
| 102 | - $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception)); |
|
| 103 | - else |
|
| 104 | - $deferred->reject($exception); |
|
| 99 | + if (!empty($exception->getResponse()->getBody())) { |
|
| 100 | + $deferred->resolve(new TelegramRawData((string) $exception->getResponse()->getBody(), $exception)); |
|
| 101 | + } else { |
|
| 102 | + $deferred->reject($exception); |
|
| 103 | + } |
|
| 105 | 104 | }); |
| 106 | 105 | |
| 107 | 106 | return $deferred->promise(); |