Repository navigation
Description
Issue Creation Checklist
- I understand that my issue will be automatically closed if I don't fill in the requested information
- I have read the contribution guidelines
Feature Description
Describe the feature you'd like to see implemented
- Drop all subclasses of
ConnectionError - Make
ConnectionAcquireTimeoutErrora subclass ofBaseErrorinstead ofConnectionError
Describe why you would like this feature to be added to Sequelize
Basically, these subclasses don't make much sense when supporting so many dialects that each have their own behavior.
While working on #17222, I also noticed that many of the tests that make sure dialect-specific errors are wrapped in one of those subclasses were broken, and that most implementations just threw the generic ConnectionError.
I believe the classes AccessDeniedError, HostNotReachableError, InvalidConnectionError, ConnectionRefusedError, HostNotFoundError, and ConnectionTimedOutError should be removed in favor of throwing a generic ConnectionError. Error details can be accessed on error.cause, which exposes all necessary information
The only exception to this is the ConnectionAcquireTimeoutError class. This error is completely different from the others because it is thrown by the pool, and is not an error that occurs when connecting to the database, unlike the others
Because it is not a database connection error, it should not extend ConnectionError. In fact, it should probably be renamed to be more explicit that this is a pool error.
Another exception could be made for ConnectionTimedOutError, as it is the only connection error that makes sense to retry automatically.
I therefore propose to remove AccessDeniedError, HostNotReachableError, InvalidConnectionError, ConnectionRefusedError, HostNotFoundError; and to make ConnectionAcquireTimeoutError extend BaseError
Is this feature dialect-specific?
- No. This feature is relevant to Sequelize as a whole.
- Yes. This feature only applies to the following dialect(s):
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I will need guidance.
- No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
- No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in implementing my feature.
Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.
Activity