1 parent 9a87a40 commit 09393e7Copy full SHA for 09393e7
1 file changed
UnityPy/files/ObjectReader.py
@@ -157,15 +157,20 @@ def Position(self, pos):
157
def reset(self):
158
self.reader.Position = self.byte_start
159
160
- def read(self):
+ def read(self, return_typetree_on_error: bool=True):
161
cls = getattr(classes, self.type.name, None)
162
163
obj = None
164
if cls:
165
try:
166
obj = cls(self)
167
except Exception as e:
168
- print(e)
+ if return_typetree_on_error:
169
+ print(f"Error during the parsing of object {self.path_id}")
170
+ print(e)
171
+ print("Returning the typetree")
172
+ else:
173
+ raise e
174
if not obj:
175
typetree = self.read_typetree()
176
if typetree:
0 commit comments