Update repository_tool.py.

Exclude the invalid metadata object included when a repository.write() exception is raised.