mollie / mollie-api-php

Mollie API client for PHP
http://www.mollie.com
BSD 2-Clause "Simplified" License
552 stars 191 forks source link

Add API request parameters to Exception message if something goes wrong #472

Closed willemstuursma closed 3 years ago

willemstuursma commented 4 years ago

We're often receiving lists of exception messages from our clients, for example:

[2020-06-04 10:19:54] app.CRITICAL: Mollie\Api\Exceptions\ApiException: cURL error 28: Operation timed out after 10001 milliseconds with 0 out of -1 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (uncaught exception) at vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php line 80 {"exception":"[object] (Mollie\\Api\\Exceptions\\ApiException(code: 0): cURL error 28: Operation timed out after 10001 milliseconds with 0 out of -1 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php:80)"} []

[2020-06-04 15:32:21] app.CRITICAL: Mollie\Api\Exceptions\ApiException: cURL error 28: Operation timed out after 10000 milliseconds with 0 out of -1 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (uncaught exception) at vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php line 80 {"exception":"[object] (Mollie\\Api\\Exceptions\\ApiException(code: 0): cURL error 28: Operation timed out after 10000 milliseconds with 0 out of -1 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at vendor/mollie/mollie-api-php/src/Exceptions/ApiException.php:80)"} []
...

It would be helpful if they had the original request attached with them as that would make it much more efficient to debug.

sandervanhooft commented 4 years ago

This would probably only affect this exception throw:

https://github.com/mollie/mollie-api-php/blob/1eac11155cf048820941f7c3d94c429075195f6e/src/MollieApiClient.php#L458

sandervanhooft commented 4 years ago

473