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

Raise exception if pg_send_*() calls fail #5888

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Jan 31, 2023

Q A
Type improvement
Fixed issues Follow-up to #5880

Summary

Raising an exception in those cases is probably better than letting an assert() fail. Not sure how to unit-test this though.

@derrabus derrabus changed the title Raise exception if pg_send_*() calls fail Raise exception if pg_send_*() calls fail Jan 31, 2023
@derrabus derrabus added this to the 3.6.0 milestone Jan 31, 2023
@greg0ire
Copy link
Member

greg0ire commented Feb 1, 2023

Not sure how to unit-test this though.

It should be a functional test I think. You might try using that kind of query: select * from doesnotexist?

@derrabus
Copy link
Member Author

derrabus commented Feb 1, 2023

That case is already well covered. Note that I'm using the async API here. Sending your query to the server will succeed. After sending the the query, I do a blocking request to fetch the result and this is where I would get an error in your case.

I think I would need to unplug the ethernet cable to make one of async calls fail. And I'm not even sure if this would actually make them fail. 🙈

Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Oh OK I didn't realize. Looks indeed quite daunting to test.

@derrabus derrabus merged commit 0b23e06 into doctrine:3.6.x Feb 1, 2023
@derrabus derrabus deleted the improvement/pgsql-error-handling branch February 1, 2023 20:13
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants