Skip to content

Commit baef09b

Browse files
committed
Fix the double wording in the InvalidAnchor exception message.
1 parent 839667e commit baef09b

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

referencing/_core.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,6 @@ def anchor(self, uri: URI, name: str):
364364
ref=uri,
365365
resource=self[uri],
366366
anchor=name,
367-
suggestion=(
368-
f"You may have intended to use '#/{name}'. The slash is "
369-
"required *before each* segment of a JSON Pointer."
370-
),
371367
)
372368
raise exceptions.NoSuchAnchor(ref=uri, resource=self[uri], anchor=name)
373369

referencing/exceptions.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,11 @@ class InvalidAnchor(Unresolvable):
119119

120120
resource: Resource[Any]
121121
anchor: str
122-
_suggestion: str | None = attrs.field(default=None, alias="suggestion")
123122

124123
def __str__(self):
125-
suggestion = (
126-
""
127-
if self._suggestion is None
128-
else (f" You may have intended to use {self._suggestion}.")
129-
)
130124
return (
131125
f"'#{self.anchor}' is not a valid anchor, neither as a "
132-
f"plain name anchor nor as a JSON Pointer.{suggestion}"
126+
"plain name anchor nor as a JSON Pointer. You may have intended "
127+
f"to use '#/{self.anchor}', as the slash is required *before each "
128+
"segment* of a JSON pointer."
133129
)

0 commit comments

Comments
 (0)