mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error when failing to decode CFI
This commit is contained in:
parent
cc89ccb265
commit
b63ca39143
@ -322,6 +322,7 @@ def decode(cfi, doc):
|
|||||||
error = None
|
error = None
|
||||||
node = doc
|
node = doc
|
||||||
|
|
||||||
|
orig_cfi = cfi
|
||||||
while cfi.length > 0 and not error:
|
while cfi.length > 0 and not error:
|
||||||
r = cfi.match(simple_node_regex)
|
r = cfi.match(simple_node_regex)
|
||||||
if r: # Path step
|
if r: # Path step
|
||||||
@ -335,7 +336,7 @@ def decode(cfi, doc):
|
|||||||
cfi = cfi.substr(r[0].length)
|
cfi = cfi.substr(r[0].length)
|
||||||
else:
|
else:
|
||||||
if target:
|
if target:
|
||||||
error = "No matching child found for CFI: " + cfi
|
error = f"No matching child found for CFI: {orig_cfi} leftover: {cfi}"
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
cfi = cfi.substr(r[0].length)
|
cfi = cfi.substr(r[0].length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user