Skip to content

Commit 850ff9b

Browse files
committed
Improve GqlError.__cause__ docs
1 parent 89a66b6 commit 850ff9b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/neo4j/exceptions.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ class GqlError(Exception):
220220
Further, it is used as the :attr:`__cause__` of GqlError subclasses.
221221
222222
Sometimes it is helpful or necessary to traverse the cause chain of
223-
GQLErrors to fully understand or appropriately handle the error. In such
223+
GqlErrors to fully understand or appropriately handle the error. In such
224224
cases, users can either traverse the :attr:`__cause__` attribute of the
225225
error(s) or use the helper method :meth:`.find_by_gql_status`. Note that
226226
:attr:`__cause__` is a standard attribute of all Python
227-
:class:`Exception`s. Therefore, the cause chain may also contain other
228-
types besides GqlError.
227+
:class:`BaseException` s: the cause chain may contain other exception types
228+
besides GqlError.
229229
230230
.. versionadded: 5.26
231231
@@ -241,6 +241,16 @@ class GqlError(Exception):
241241
_diagnostic_record: dict[str, _t.Any] # copy to be used externally
242242
_gql_cause: GqlError | None
243243

244+
__cause__: BaseException | None
245+
"""
246+
The GqlError's cause, if any.
247+
248+
Sometimes it is helpful or necessary to traverse the cause chain of
249+
GqlErrors to fully understand or appropriately handle the error.
250+
251+
.. seealso:: :meth:`.find_by_gql_status`
252+
"""
253+
244254
@staticmethod
245255
def _hydrate_cause(**metadata: _t.Any) -> GqlError:
246256
meta_extractor = _MetaExtractor(metadata)

0 commit comments

Comments
 (0)