Open stanleynguyen opened 4 years ago
Saya kesulitan menangkap error message pada saat request pembuatan transaksi OVO. Saya menggunakan library xendit-php. Apa yang perlu saya lakukan untuk mendapatkan pesan error setelah menuliskan kode berikut : $createOvo = \Xendit\EWallets::create($ovoParams);
I just stumbled upon a similar issue here.. I have implemented a custom HTTPClient for Xendit to support calls using a proxy server. By coincidence, our proxy server was rejecting requests and returning HTTP (header) Code 407 and no body in the HTTP response. This is the uncaught error:
[Tue Feb 02 12:29:54.223559 2021] [php7:error] [pid 90687] [client 10.22.0.15:33294] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Xendit\\Exceptions\\ApiException::__construct(), 1 passed in <masked>/vendor/xendit/xendit-php/src/Exceptions/ApiException.php on line 50 and exactly 3 expected in <masked>/vendor/xendit/xendit-php/src/Exceptions/ApiException.php:47
Stack trace:
#0 <masked>/vendor/xendit/xendit-php/src/Exceptions/ApiException.php(50): Xendit\\Exceptions\\ApiException->__construct('Unknown Xendit\\\\...')
#1 <masked>/vendor/xendit/xendit-php/src/HttpClient/GuzzleClient.php(167): Xendit\\Exceptions\\ApiException->__construct(NULL, '407', NULL)
This is the $response in GuzzleClient _handleApiError()
:
[body] =>
[code] => 407
[header] => Array
(
[Server] => Array
(
[0] => squid/3.5.20
)
[Mime-Version] => Array
(
[0] => 1.0
)
[Date] => Array
(
[0] => Tue, 02 Feb 2021 13:41:04 GMT
)
[Content-Type] => Array
(
[0] => text/html;charset=utf-8
)
[Content-Length] => Array
(
[0] => 3523
)
[X-Squid-Error] => Array
(
[0] => ERR_CACHE_ACCESS_DENIED 0
)
[Vary] => Array
(
[0] => Accept-Language
)
[Content-Language] => Array
(
[0] => en
)
[Proxy-Authenticate] => Array
(
[0] => Basic realm="Squid proxy-caching web server"
)
[X-Cache] => Array
(
[0] => MISS from <proxyserver.com>
)
[X-Cache-Lookup] => Array
(
[0] => NONE from <proxyserver.com>:<port>>
)
[Via] => Array
(
[0] => 1.1 <proxyserver.com> (squid/3.5.20)
https://github.com/xendit/xendit-php/blob/515d062585b9261a07727b848666680bf1fd6b61/src/HttpClient/GuzzleClient.php#L132-L141 sometimes give this error
Call to a member function getBody() on null on line 133
as the response is not always there