capture the return value of  file manipulation API and throw an error when they fail. close #91