Handle errors better for mediaGen