From b63ca391430b85475c680da7d868a57b6feb85f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 19 Apr 2023 22:54:34 +0530 Subject: [PATCH] Nicer error when failing to decode CFI --- src/pyj/read_book/cfi.pyj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/cfi.pyj b/src/pyj/read_book/cfi.pyj index 537a20a6a2..41f4ec6ccd 100644 --- a/src/pyj/read_book/cfi.pyj +++ b/src/pyj/read_book/cfi.pyj @@ -322,6 +322,7 @@ def decode(cfi, doc): error = None node = doc + orig_cfi = cfi while cfi.length > 0 and not error: r = cfi.match(simple_node_regex) if r: # Path step @@ -335,7 +336,7 @@ def decode(cfi, doc): cfi = cfi.substr(r[0].length) else: if target: - error = "No matching child found for CFI: " + cfi + error = f"No matching child found for CFI: {orig_cfi} leftover: {cfi}" break else: cfi = cfi.substr(r[0].length)