Catch directive document encode errors