forked from MostAwesomeDude/construct
-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
Is there a way to get everything parsed so far (kind of like Probe() does) when an error is raised during parsing?
Simple example of what I am looking for:
import construct as cs
Test = cs.Struct(
"a" / cs.Byte,
"b" / cs.Byte,
)
try:
# Only one byte in input
result = Test.parse(b"1")
except Exception as e:
print(e.parsed_so_far)This would print
Container:
a = 49
I looked around the codebase, and the exceptions raised currently don't contain this information. Maybe there is some other way?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels