Browse Source

Merge pull request #895 from seth-shaw-asu/issue-2152

Issue-2152: Throw error instead of returning null data
pull/898/head
Alan Stanley 2 years ago committed by GitHub
parent
commit
62fbc6d288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Plugin/Action/AbstractGenerateDerivativeMediaFile.php

2
src/Plugin/Action/AbstractGenerateDerivativeMediaFile.php

@ -40,7 +40,7 @@ class AbstractGenerateDerivativeMediaFile extends AbstractGenerateDerivativeBase
protected function generateData(EntityInterface $entity) { protected function generateData(EntityInterface $entity) {
$data = parent::generateData($entity); $data = parent::generateData($entity);
if (get_class($entity) != 'Drupal\media\Entity\Media') { if (get_class($entity) != 'Drupal\media\Entity\Media') {
return; throw new \RuntimeException("Entity {$entity->getEntityTypeId()} {$entity->id()} is not a media", 500);
} }
$source_file = $this->mediaSource->getSourceFile($entity); $source_file = $this->mediaSource->getSourceFile($entity);
if (!$source_file) { if (!$source_file) {

Loading…
Cancel
Save