]> git.mxchange.org Git - friendica.git/commitdiff
Exception handling added
authorMichael <heluecht@pirati.ca>
Tue, 5 Dec 2023 22:33:45 +0000 (22:33 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 5 Dec 2023 22:33:45 +0000 (22:33 +0000)
src/Content/Post/Factory/PostMedia.php
src/Content/Post/Repository/PostMedia.php

index 864786569fa535d44e5f9f3a2fb85040d9c8039a..dfebfd487467f7157eb7d3a4923cff779153e282 100644 (file)
@@ -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'],
index 405d9eb86bfe8accb3bde4f7edd02bd23c456a18..70441e0c9d881c892406e4736ef9328c7ae6a81f 100644 (file)
@@ -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;