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

Throw our own exception in \OCP\DB\QueryBuilder\IQueryBuilder::execute #26182

Closed
wants to merge 1 commit into from

Conversation

ChristophWurst
Copy link
Member

Just as documented. This seems to be a leftover form the dbal changes in
21. We noticed that execute still throws the raw dbal exception and
catches for the documented execption never trigger.

Follow-up to #24948

@ChristophWurst
Copy link
Member Author

/backport to stable21

@ChristophWurst
Copy link
Member Author

This change actually has a lot of potential to break things 😬

@MorrisJobke
Copy link
Member

CI says "no" :/

@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Mar 18, 2021
@rullzer
Copy link
Member

rullzer commented Mar 19, 2021

execute is depratecated anyway. I vote to not break stuff. And just leave it as it. Then when we move stuff over it will just get cleaner over time

@ChristophWurst
Copy link
Member Author

The exception is documented to be thrown in our upgrade docs and in the method docblock. This is confusing for devs and static analysis. Shall we fix the docblock instead? Both are breaking fixes.

@rullzer
Copy link
Member

rullzer commented Mar 19, 2021

The exception is documented to be thrown in our upgrade docs and in the method docblock. This is confusing for devs and static analysis. Shall we fix the docblock instead? Both are breaking fixes.

Ah ok I missed that part.
But this was only for 21 right?
I guess fixing the doc block is better here.

@nickvergessen
Copy link
Member

I vote for doing it with our Exception. We promoted it in the upgrade docs and people released all their apps with it I guess?

@ChristophWurst
Copy link
Member Author

I vote for doing it with our Exception. We promoted it in the upgrade docs and people released all their apps with it I guess?

It will depend on whether people adjusted their code to what the method docs say or what exceptions they found during debugging.

Both changing the thrown exception and changing the documented exception has potential for an ugly breaking change, but I'd rather break towards a consistent API.

@ChristophWurst
Copy link
Member Author

In any case for master we should definitely do this. Only the backport to 21 is up for debate :)

@MorrisJobke
Copy link
Member

CI says "no" :/

That hasn't changed yet 😢

@rullzer
Copy link
Member

rullzer commented May 18, 2021

ping

This was referenced May 20, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 22, Nextcloud 23 Jun 2, 2021
Just as documented. This seems to be a leftover form the dbal changes in
21. We noticed that `execute` still throws the raw dbal exception and
catches for the documented execption never trigger.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst force-pushed the fix/qb-execute-exception branch from afffc0c to 57f9011 Compare June 2, 2021 16:18
@ChristophWurst
Copy link
Member Author

All code using execute but catching stuff like UniqueConstraintViolationException fails 🤡

@nickvergessen
Copy link
Member

So, 🤡 idea:
only fix the exception on executeStatement and executeQuery. They are new in 22 and execute is deprecated and still throws the old exceptions?

@ChristophWurst
Copy link
Member Author

I like your thinking.

@ChristophWurst
Copy link
Member Author

only fix the exception on executeStatement and executeQuery. They are new in 22 and execute is deprecated and still throws the old exceptions?

That is actually our current situation.

@nickvergessen
Copy link
Member

nickvergessen commented Jun 4, 2021

Yeah but the methods are newer than this PR? So adjust the docs of execute() instead?
Or we make a new class which inherits from both :-X so SorryUniqueConstraintViolationException is a UniqueConstraintViolationException aswell as a DoctrineException

@ChristophWurst
Copy link
Member Author

Or we make a new class which inherits from both :-X so SorryUniqueConstraintViolationException is a UniqueConstraintViolationException aswell as a DoctrineException

Then I need this for all the ~15 subtypes of doctrine's exception. This isn't practical at all.

@nickvergessen
Copy link
Member

So adjust the docs of execute() instead?

So lets adjust the docs on the deprecated method to the reality and the new code is good going forward?

@MorrisJobke MorrisJobke removed their request for review July 4, 2021 11:34
@skjnldsv skjnldsv mentioned this pull request Oct 13, 2021
@skjnldsv skjnldsv modified the milestones: Nextcloud 23, Nextcloud 24 Oct 21, 2021
@skjnldsv skjnldsv mentioned this pull request Mar 24, 2022
@blizzz blizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@blizzz blizzz modified the milestones: Nextcloud 24, Nextcloud 25 Apr 21, 2022
@ChristophWurst
Copy link
Member Author

Let's leave this deprecated method as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
Development

Successfully merging this pull request may close these issues.

6 participants