1
0
mirror of https://github.com/rzzzwilson/pymlac.git synced 2025-06-10 09:32:41 +00:00

Catch exceptions and report failure

This commit is contained in:
Ross Wilson
2016-02-23 15:15:39 +07:00
parent 40970ef898
commit 559c49cff8

View File

@@ -362,13 +362,16 @@ def load(filename, memory=None):
# try loaders in order
for (name, loader) in Loaders:
result = loader(ptp_data, memory)
try:
result = loader(ptp_data, memory)
except IndexError:
result = None
if result is not None:
print('%s: %s successful!' % (filename, name))
print('%14s: %s' % (name, filename))
return result
# if we get here, no loader was successful
print('%s: not recognized!' % filename)
print('NOT RECOGNIZED: %s' % filename)
return None
if __name__ == '__main__':