From 1709633ab6d82c698d58fa55acf50674a145f86f Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Mon, 21 Jul 2025 11:14:47 +0200 Subject: [PATCH] Make `UnsupportedServerProduct` subclass of `ConfigurationError` --- CHANGELOG.md | 4 ++-- docs/source/api.rst | 10 +++++----- src/neo4j/exceptions.py | 30 +++++++++++++++--------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08238ed6..44d301b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,7 +41,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog. - Consistently check the value (also for non-routing drivers) - `neo4j.exceptions.UnsupportedServerProduct` if no common bolt protocol version could be negotiated with the server (instead of internal `neo4j._exceptions.BoltHandshakeError`). - `UnsupportedServerProduct` is now a subclass of `ServiceUnavailable` (instead of `Exception` directly). + `UnsupportedServerProduct` is now a subclass of `ConfigurationError` (instead of `Exception` directly). - `connection_acquisition_timeout` configuration option - Raise `ValueError` on invalid values (instead of `ClientError`). - Consistently restrict the value to be strictly positive @@ -71,7 +71,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog. If you were calling it directly, please use `Record.__getitem__(slice(...))` or simply `record[...]` instead. - Bookmarks - Remove deprecated class `neo4j.Bookmark` in favor of `neo4j.Bookmarks`. - - Remove deprecated class `session.last_bookmark()` in favor of `last_bookmarks()`. + - Remove deprecated method `session.last_bookmark()` in favor of `last_bookmarks()`. - Deprecate passing raw sting bookmarks as `initial_bookmarks` to `GraphDatabase.bookmark_manager()`. Use a `neo4j.Bookmarks` object instead. - `Driver.session()` no longer accepts raw string bookmarks as `bookmarks` argument. diff --git a/docs/source/api.rst b/docs/source/api.rst index 157864d9..b9c77fd3 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -2084,8 +2084,6 @@ Client-side errors * :class:`neo4j.exceptions.ReadServiceUnavailable` - * :class:`neo4j.exceptions.UnsupportedServerProduct` - * :class:`neo4j.exceptions.IncompleteCommit` * :class:`neo4j.exceptions.ConfigurationError` @@ -2094,6 +2092,8 @@ Client-side errors * :class:`neo4j.exceptions.CertificateConfigurationError` + * :class:`neo4j.exceptions.UnsupportedServerProduct` + * :class:`neo4j.exceptions.ConnectionPoolError` * :class:`neo4j.exceptions.ConnectionAcquisitionTimeoutError` @@ -2145,9 +2145,6 @@ Client-side errors .. autoexception:: neo4j.exceptions.ReadServiceUnavailable() :show-inheritance: -.. autoexception:: neo4j.exceptions.UnsupportedServerProduct() - :show-inheritance: - .. autoexception:: neo4j.exceptions.IncompleteCommit() :show-inheritance: @@ -2160,6 +2157,9 @@ Client-side errors .. autoexception:: neo4j.exceptions.CertificateConfigurationError() :show-inheritance: +.. autoexception:: neo4j.exceptions.UnsupportedServerProduct() + :show-inheritance: + Internal Driver Errors diff --git a/src/neo4j/exceptions.py b/src/neo4j/exceptions.py index a1fe53d0..b622a0b7 100644 --- a/src/neo4j/exceptions.py +++ b/src/neo4j/exceptions.py @@ -51,11 +51,11 @@ + RoutingServiceUnavailable + WriteServiceUnavailable + ReadServiceUnavailable - + UnsupportedServerProduct + IncompleteCommit + ConfigurationError + AuthConfigurationError + CertificateConfigurationError + + UnsupportedServerProduct + ConnectionPoolError + ConnectionAcquisitionTimeoutError """ @@ -1028,20 +1028,6 @@ class ReadServiceUnavailable(ServiceUnavailable): """Raised when no read service is available.""" -# DriverError > ServiceUnavailable > UnsupportedServerProduct -class UnsupportedServerProduct(ServiceUnavailable): - """ - Raised when an unsupported server product is detected. - - .. versionchanged:: 6.0 - This exception is now a subclass of :class:`ServiceUnavailable`. - Before it was a subclass of :class:`Exception`. - """ - - def __init__(self, *args: object) -> None: - super().__init__(*args) - - # DriverError > ServiceUnavailable > IncompleteCommit class IncompleteCommit(ServiceUnavailable): """ @@ -1085,6 +1071,20 @@ class CertificateConfigurationError(ConfigurationError): """Raised when there is an error with the certificate configuration.""" +# DriverError > ConfigurationError > UnsupportedServerProduct +class UnsupportedServerProduct(ConfigurationError): + """ + Raised when an unsupported server product is detected. + + .. versionchanged:: 6.0 + This exception is now a subclass of :class:`ConfigurationError`. + Before it was a subclass of :class:`Exception`. + """ + + def __init__(self, *args: object) -> None: + super().__init__(*args) + + # DriverError > ConnectionPoolError class ConnectionPoolError(DriverError): """Raised when the connection pool encounters an error."""