Improve error handling of GetOneFile