Drop subclasses of SequelizeConnectionError
#17240
Labels
type: feature
For issues and PRs. For new features. Never breaking changes.
SequelizeConnectionError
#17240
Issue Creation Checklist
Feature Description
Describe the feature you'd like to see implemented
ConnectionError
ConnectionAcquireTimeoutError
a subclass ofBaseError
instead 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
, andConnectionTimedOutError
should be removed in favor of throwing a genericConnectionError
. Error details can be accessed onerror.cause
, which exposes all necessary informationThe 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 othersBecause 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 makeConnectionAcquireTimeoutError
extendBaseError
Is this feature dialect-specific?
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the addition of this feature by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: