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

[8.x] Dispatch 'connection failed' event in http client #37740

Merged

Conversation

gdebrauwer
Copy link
Contributor

Currently, if a ConnectException is thrown by Guzzle, then no event is fired as there is no response. This PR adds a ConnectionFailed event that is fired before Laravel throws its own ConnectionException.

This event will make it possible to also track those failed requests in Telescope or other tools that listen for the events of the Http Client.

I did not add a test for this because I could not find an existing test that simulates a Guzzle ConnectException.

@gdebrauwer gdebrauwer changed the title Dispatch 'connection failed' event in http client [8.x] Dispatch 'connection failed' event in http client Jun 19, 2021
@taylorotwell taylorotwell merged commit 4deb641 into laravel:8.x Jun 21, 2021
@SergkeiM
Copy link

Hi @gdebrauwer

In laravel 10.* there is an error dispatching this,

Illuminate\Http\Client\Events\ConnectionFailed::__construct(): Argument #1 ($request) must be of type Illuminate\Http\Client\Request, null given, called in /app/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php on line 1386

@gdebrauwer
Copy link
Contributor Author

@SergkeiM Can you create a bug issue with some code on how to reproduce it?

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

Successfully merging this pull request may close these issues.

3 participants