Skip to content

Improve error reporting when custom error handler is used - #28

Merged
clue merged 1 commit into
clue:1.xfrom
clue-labs:error-handler
Oct 25, 2026
Merged

clue merged 1 commit into
clue:1.xfrom
clue-labs:error-handler

Conversation

@clue

@clue clue commented Oct 25, 2026

Copy link
Copy Markdown
Owner

This changeset improves error reporting when custom error handler is used (set_error_handler()), as discussed in reactphp/socket#290. Joining a multicast group could report a PHP warning before throwing, so a custom error handler would see this warning and one converting warnings to exceptions would throw an ErrorException instead of the documented RuntimeException. This has been the case since #6 switched to the stream based API in v0.2.0 (2015).

The RuntimeException now also includes the underlying error reason and code, such as Unable to join multicast group: Invalid argument with code 22 (EINVAL). Otherwise, the behavior is unchanged.

Builds on top of #6 and reactphp/socket#290

@clue clue added bug Something isn't working new feature New feature or request labels Oct 25, 2026
@clue clue added this to the v1.3.0 milestone Oct 25, 2026
@clue
clue requested a balanced review from Copilot October 25, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation and regression test address the reported behavior with no identified blocking issues.

No open issues 🎉

What changed in this PR

Improves multicast receiver error reporting so custom PHP error handlers do not intercept join-group warnings, while preserving the documented RuntimeException.

Changes:

  • Suppresses warnings during multicast group joining and restores the previous error handler afterward.
  • Includes the socket error reason and code in exceptions, with regression coverage.
File Description
tests/​FunctionalTest.php Verifies exception details and that the custom error handler is not called.
src/​Factory.php Suppresses join-group warnings and adds underlying socket error details to exceptions.

Review effort: Balanced

@clue
clue merged commit 1210598 into clue:1.x Oct 25, 2026
16 checks passed
@clue
clue deleted the error-handler branch October 25, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants