Skip to content
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

When Internet is not available socket_connect throws a 'Host name lookup failure' PHP error #34

Open
daN4cat opened this issue Nov 11, 2016 · 2 comments

Comments

@daN4cat
Copy link
Contributor

daN4cat commented Nov 11, 2016

In no Internet available condition, the socket_connect call in Socket.php createConnection function throws the following error:

A PHP Error was encountered
Servetity: Warning

Message: socket_connect(): Host loockup failed [-10002]: Host name lookup failure
Filename: Adapter/Socket.php

Line Number: 32

Backtrace:
[...]

that ignoring the possible false return, and any exception throwing and try&catch.

Is there any way to avoid that error message in that specific call?

@ins0
Copy link
Owner

ins0 commented Nov 12, 2016

Thanks @daN4cat!
I personally think it is better to throw an exception and let the consumer decide how to handle this exception. But it would be better to throw an generic connection exception than the socket specific error. What is you opinion on this?

@daN4cat
Copy link
Contributor Author

daN4cat commented Nov 13, 2016

Ideally this should be captured at the level of function call and then throw the already existing exception, I believe we are saying the same.

The current way bypasses what is already in place and doesn't allow any sensible handling (e.g. switch off the GA feature, retry later, simple error logging) at top function caller level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants