Commit d942cf62 authored by Evan Pretti's avatar Evan Pretti
Browse files

Reformat error message for XML load failure

parent bfde67e9
......@@ -258,13 +258,11 @@ class ForceField(object):
raise ValueError('Could not locate file "%s"' % file)
except Exception as e:
# Fail with an error message about which file could not be read.
msg = str(e) + '\n'
if hasattr(file, 'name'):
filename = file.name
else:
filename = str(file)
msg += "ForceField.loadFile() encountered an error reading file '%s'\n" % filename
raise Exception(msg)
raise Exception('ForceField.loadFile() encountered an error reading file "%s": %s' % (filename, e))
trees.append(tree)
i += 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment