Skip to content

Conversation

clue
Copy link
Member

@clue clue commented Sep 6, 2021

This changeset improves error messages for failed connections to include the errno (the internal error number exposed by the underlying system functions and its constant name).

- Connection to tcp://localhost:80 cancelled during DNS lookup
- Connection to tcp://localhost:80 failed: Last error for IPv4: Connection to tcp://127.0.0.1:80 failed: Connection refused. Previous error for IPv6: Connection to tcp://[::1]:80 failed: Connection refused
+ Connection to tcp://localhost:80 cancelled during DNS lookup (ECONNABORTED)
+ Connection to tcp://localhost:80 failed: Last error for IPv4: Connection to tcp://127.0.0.1:80 failed: Connection refused (ECONNREFUSED). Previous error for IPv6: Connection to tcp://[::1]:80 failed: Connection refused (ECONNREFUSED)

The errno value describes the type of error that has been encountered. This value is exposed by a number of system functions but not always exposed by many higher-level PHP functions. This changeset implements a number of ways to report or look up the errno value based on the errstr and find a matching errno constant name. This can be useful to provide more context and more descriptive error messages. The specific error conditions and codes used are system specific and in many cases are only exposed when ext-sockets is available (which is entirely optional, but the default on most installations of PHP).

Builds on top of #270, #265, #266, #267 and others such as clue/reactphp-redis#116, friends-of-reactphp/mysql#141 and more

@clue clue added this to the v1.10.0 milestone Sep 6, 2021
@clue clue requested a review from WyriHaximus September 10, 2021 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants