Exception handling added
This commit is contained in:
parent
0df88fd5a0
commit
914d4506e2
|
@ -49,7 +49,7 @@ class PostMedia extends BaseFactory implements ICanCreateFromTableRow
|
|||
{
|
||||
return new Entity\PostMedia(
|
||||
$row['uri-id'],
|
||||
UtilNetwork::createUriFromString($row['url']) ?: '',
|
||||
UtilNetwork::createUriFromString($row['url']),
|
||||
$row['type'],
|
||||
$this->mimeTypeFactory->createFromContentType($row['mimetype']),
|
||||
$row['media-uri-id'],
|
||||
|
|
|
@ -45,7 +45,11 @@ class PostMedia extends BaseRepository
|
|||
|
||||
$Entities = new Collection\PostMedias();
|
||||
foreach ($rows as $fields) {
|
||||
$Entities[] = $this->factory->createFromTableRow($fields);
|
||||
try {
|
||||
$Entities[] = $this->factory->createFromTableRow($fields);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->warning('Invalid media row', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'fields' => $fields]);
|
||||
}
|
||||
}
|
||||
|
||||
return $Entities;
|
||||
|
|
Loading…
Reference in New Issue
Block a user