'PHP Fatal error: Uncaught SoapFault exception in error_log

I'm doing some requests to an external service, problem is that sometimes the external service is not responding (I think their server is offline or something like that).

The problem with that is the error which is written each time on the error_log:

[07-May-2022 04:31:05 UTC] PHP Fatal error:  Uncaught SoapFault exception: [HTTP] Could not connect to host in /path/file.php:115
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://app.mela...', 'http://app.mela...', 1, 0)
....
....

How to avoid to write that error inside error log?

The code inside /path/file.php:115 is this:

$response = $this->client->getOrders($userId,$order,$orderColumn,$orderType,$limitStart,$limitSize);

Thanks for your help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source