-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't catch exception #2
Comments
This means it cannot connect to the socket. I will check it at a suitable time and update if there is an error. |
Yes I know, want to handle such errors, but can't catch the exception. |
I understand, you are complaining about not being able to catch the error. The first error I see in your code is the "\" symbol you use at the beginning of the SocketConnectionException and SocketInvalidArgumentException errors. Try updating your code as below. use \InitPHP\Socket\Socket;
use \InitPHP\Socket\Exception\SocketConnectionException;
use \InitPHP\Socket\Exception\SocketInvalidArgumentException;
use \Exception;
use \Throwable;
try
{
//error_reporting(0);
@ini_set("default_socket_timeout",15);
$this->client = Socket::client(Socket::TCP,$this->params['connectip'],$this->params['port']);
}
catch(Exception | Throwable | SocketInvalidArgumentException | SocketConnectionException $e)
{
$this->error=$e->getMessage();
$this->setLog('connect error',$this->error);
return false;
} |
I have already tried it with and without. Can you please make your own tests? |
Final it's ok |
Can you help?
( ! ) Fatal error: Uncaught InitPHP\Socket\Exception\SocketConnectionException: Socket Connection Error : 10060 vendor\initphp\socket\src\Client\TCP.php on line 55
The text was updated successfully, but these errors were encountered: