Add location information when raising InvalidTextLocationError

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-07-15 19:29:16 +02:00
1 parent c80d76abe9
commit ba5ade0d4e
1 file changed
+2 -2
+2 -2
View File
@@ -179,7 +179,7 @@ class TextUtils:
# handle the case where the end of the text was reached without stepping past the index
if index > text_stepper.idx:
raise InvalidTextLocationError
raise InvalidTextLocationError(f"{index=}")
return text_stepper.line, text_stepper.col
@classmethod
@@ -203,7 +203,7 @@ class TextUtils:
text_stepper = TextStepper(text)
while text_stepper.line < line:
if not text_stepper.step_line():
raise InvalidTextLocationError
raise InvalidTextLocationError("{line=}, {col=}")
return text_stepper.line_start_idx + col