CAtch the InvalidDocument error and log it.