Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Mailer] Make sure Http TransportException is not leaking #42184

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
merged 1 commit into from
Jul 20, 2021

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jul 19, 2021

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

We dont want the mailer to throw exceptions from the http-client component. This will make sure to catch such exceptions and rethrow the proper HttpTransportException from the Mailer component.

@carsonbot carsonbot added this to the 5.2 milestone Jul 19, 2021
@Nyholm Nyholm force-pushed the mailer-http-transport-exception branch from 82a061e to f888d56 Compare July 19, 2021 00:40
@OskarStark
Copy link
Contributor

One minor question, why not against 4.4?

} catch (TransportExceptionInterface $e) {
throw new HttpTransportException('Could not reach the remote Mailgun server.', $response, 0, $e);
}

if (200 !== $response->getStatusCode()) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd wrap the call to getStatusCode and toArray in the same try/catch (same everywhere)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I will but why? This will never throw TransportExceptionInterface if I first get the body.

Copy link
Member

Choose a reason for hiding this comment

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

I'd say to make things easy to reason about and consistent (some places were calling getStatusCode before toArray/getContent)

@Nyholm Nyholm force-pushed the mailer-http-transport-exception branch from f888d56 to 1681bc1 Compare July 19, 2021 21:26
@Nyholm Nyholm changed the base branch from 5.2 to 4.4 July 19, 2021 21:26
@Nyholm Nyholm modified the milestones: 5.2, 4.4 Jul 19, 2021
@Nyholm
Copy link
Member Author

Nyholm commented Jul 19, 2021

The PR is updated.

I've targeted 4.4 and made sure we get both status code and body inside the try/catch

@nicolas-grekas
Copy link
Member

Thank you @Nyholm.

@nicolas-grekas nicolas-grekas merged commit 3413e23 into symfony:4.4 Jul 20, 2021
@Nyholm Nyholm deleted the mailer-http-transport-exception branch July 20, 2021 13:47
This was referenced Jul 26, 2021
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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.