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

Add some missing @throws annotations and fix thrown exceptions #4160

Merged
merged 10 commits into from
Jul 10, 2020

Conversation

morozov
Copy link
Member

@morozov morozov commented Jul 10, 2020

Q A
Type improvement
BC Break yes

Roughly half of the error handling issues reported by PhpStorm have been fixed. The following categories of issues still need fixing:

  1. Wrapper-level components implement the driver-level interfaces which are allowed to throw a driver-level exception but the consumers don't catch them because they are in fact impossible. This will be addressed in Do not implement driver-level interfaces by wrapper-level classes #4159.
  2. The lazy platform detection via Connection::getDatabasePlatform() can fail at literally any point in time.
  3. The "not supported" exceptions thrown in AbstractPlatform::get*DeclarationSQL() and similar methods should have a special type that could be declared as unchecked (e.g. LogicalException). Those are not meant to be handled at runtime (see the details).
  4. Similarly to the issue addressed in Add TypeRegistry constructor #4145, there are issues with Type::getType() that technically may thrown an exception but practically doesn't and those cases are reported as not handling the exception (need a specialized exception-less API).
  5. The Schema namespace depends on the Type one internally but doesn't handle its exceptions and therefore may throw a generic DBALException.
  6. The wrapper-level components that wrap the driver ones should be more specific about the exception they throw and when possible declare it as the wrapper-level DriverException instead of the generic DBALException.

@morozov morozov force-pushed the some-missing-exceptions branch from ff16ff9 to 06a8fac Compare July 10, 2020 18:37
@morozov morozov merged commit 8002ccc into doctrine:3.0.x Jul 10, 2020
@morozov morozov deleted the some-missing-exceptions branch July 10, 2020 21:59
@morozov morozov self-assigned this Jul 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2022
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.

3 participants