Refactor textract to import in task and throw better exceptions.