Skip to content

Commit 593ac58

Browse files
author
matmoncon
committed
refactor: rename NoResultsFound to UnexpectedEmptyResult
1 parent c6a2901 commit 593ac58

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pyneo4j_ogm/exceptions.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Pyneo4j exceptions raised by the client or model classes.
33
"""
4-
from typing import List
4+
from typing import Any, List
55

66

77
class Pyneo4jException(Exception):
@@ -92,7 +92,7 @@ def __init__(self, *args: object) -> None:
9292
super().__init__("Queries can not be run on instances which have been destroyed", *args)
9393

9494

95-
class NoResultsFound(Pyneo4jException):
95+
class UnexpectedEmptyResult(Pyneo4jException):
9696
"""
9797
A query should have returned results, but did not. This exception does not include a specific
9898
reason for why it failed, as it is not possible to determine the reason.
@@ -149,7 +149,7 @@ def __init__(self, *args: object) -> None:
149149

150150
class NotConnectedToSourceNode(Pyneo4jException):
151151
"""
152-
The `replace()` method was called with a node which is not connected to the source node.
152+
A relationship-property method was called with a node which is not connected to the source node.
153153
"""
154154

155155
def __init__(self, *args: object) -> None:
@@ -200,3 +200,12 @@ def __init__(
200200
{end_model} is being violated.""",
201201
*args,
202202
)
203+
204+
205+
class NoResultFound(Pyneo4jException):
206+
"""
207+
A query with required filters did not match any results.
208+
"""
209+
210+
def __init__(self, filters: Any, *args: object) -> None:
211+
super().__init__(f"No matching results for filter {filters}", *args)

0 commit comments

Comments
 (0)