Use filename in error message
Log errors during document processing