-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[12.x] Improve BroadcastManager error messages when trying to get a Broadcaster #57275
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
Merged
+38
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…roadcaster Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster. Missing to provide a value for REVERB_APP_KEY, REVERB_APP_ID or REVERB_APP_SECRET would throw an error such as `TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given` and it would occur after running `composer install`, `php artisan optimize` or any command that would cause the broadcasting to be booted. This change wraps driver creation in a try-catch block that throws a BroadcastException with the connection name, making it immediately clear where the error is coming from and which configuration needs to be fixed. Before: > TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given After: > BroadcastException: Failed to create broadcaster for connection "terminal" with error: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
…roadcaster Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster. Missing to provide a value for REVERB_APP_KEY, REVERB_APP_ID or REVERB_APP_SECRET would throw an error such as `TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given` and it would occur after running `composer install`, `php artisan optimize` or any command that would cause the broadcasting to be booted. This change wraps driver creation in a try-catch block that throws a BroadcastException with the connection name, making it immediately clear where the error is coming from and which configuration needs to be fixed. Before: > TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given After: > BroadcastException: Failed to create broadcaster for connection "my-connection" with error: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
…roadcaster Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster. Missing to provide a value for REVERB_APP_KEY, REVERB_APP_ID or REVERB_APP_SECRET would throw an error such as `TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given` and it would occur after running `composer install`, `php artisan optimize` or any command that would cause the broadcasting to be booted. This change wraps driver creation in a try-catch block that throws a BroadcastException with the connection name, making it immediately clear where the error is coming from and which configuration needs to be fixed. Before: > TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given After: > BroadcastException: Failed to create broadcaster for connection "my-connection" with error: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
…roadcaster Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster. Missing to provide a value for REVERB_APP_KEY, REVERB_APP_ID or REVERB_APP_SECRET would throw an error such as `TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given` and it would occur after running `composer install`, `php artisan optimize` or any command that would cause the broadcasting to be booted. This change wraps driver creation in a try-catch block that throws a BroadcastException with the connection name, making it immediately clear where the error is coming from and which configuration needs to be fixed. Before: > TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given After: > BroadcastException: Failed to create broadcaster for connection "my-connection" with error: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
…roadcaster Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster. Missing to provide a value for REVERB_APP_KEY, REVERB_APP_ID or REVERB_APP_SECRET would throw an error such as `TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given` and it would occur after running `composer install`, `php artisan optimize` or any command that would cause the broadcasting to be booted. This change wraps driver creation in a try-catch block that throws a BroadcastException with the connection name, making it immediately clear where the error is coming from and which configuration needs to be fixed. Before: > TypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given After: > BroadcastException: Failed to create broadcaster for connection "my-connection" with error: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given Testing using the LogBroadcaster since it is always available, while Pusher\Pusher is not.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, when a broadcaster driver failed to initialize, the error message would only show the underlying exception without indicating which broadcasting connection configuration was responsible, and it was hard to identify it was actually coming from a broadcaster.
Missing to provide a value for
REVERB_APP_KEY
,REVERB_APP_ID
orREVERB_APP_SECRET
would throw an error such asTypeError: Pusher\Pusher::__construct(): Argument #3 ($app_id) must be of type string, null given
and it would occur after runningcomposer install
,php artisan migrate
,php artisan optimize
or any command that would cause the broadcasting to be booted.This change wraps driver creation in a try-catch block that throws a
BroadcastException
with the connection name, making it immediately clear where the error originates and which configuration needs to be corrected.Before:
After:
Testing using the
LogBroadcaster
since it is always available, whilePusher\Pusher
is not.