Differential D12680 Diff 30538 src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | foreach ($this->attachments as $attachment) { | ||||
| 'attachment', | 'attachment', | ||||
| $attachment['data'], | $attachment['data'], | ||||
| $attachment['name'], | $attachment['name'], | ||||
| $attachment['type']); | $attachment['type']); | ||||
| } | } | ||||
| list($body) = $future->resolvex(); | list($body) = $future->resolvex(); | ||||
| $response = json_decode($body, true); | $response = null; | ||||
| if (!is_array($response)) { | try { | ||||
| throw new Exception("Failed to JSON decode response: {$body}"); | $response = phutil_json_decode($body); | ||||
| } catch (PhutilJSONParserException $ex) { | |||||
| throw new PhutilProxyException( | |||||
| pht('Failed to JSON decode response.'), | |||||
| $ex); | |||||
| } | } | ||||
| if (!idx($response, 'id')) { | if (!idx($response, 'id')) { | ||||
| $message = $response['message']; | $message = $response['message']; | ||||
| throw new Exception("Request failed with errors: {$message}."); | throw new Exception("Request failed with errors: {$message}."); | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||