]> git.mxchange.org Git - friendica.git/commitdiff
Use "Exception"
authorMichael <heluecht@pirati.ca>
Sun, 26 Feb 2023 22:43:45 +0000 (22:43 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 26 Feb 2023 22:43:45 +0000 (22:43 +0000)
20 files changed:
src/Contact/Avatar.php
src/Factory/Api/Mastodon/Notification.php
src/Factory/Api/Mastodon/Status.php
src/Model/APContact.php
src/Model/Contact.php
src/Model/Post/Link.php
src/Module/Api/Mastodon/Accounts/Statuses.php
src/Module/Api/Mastodon/Bookmarks.php
src/Module/Api/Mastodon/Favourited.php
src/Module/Api/Mastodon/Lists/Accounts.php
src/Module/Api/Mastodon/Search.php
src/Module/Api/Mastodon/Timelines/Home.php
src/Module/Api/Mastodon/Timelines/ListTimeline.php
src/Module/Api/Mastodon/Timelines/PublicTimeline.php
src/Module/Api/Mastodon/Timelines/Tag.php
src/Module/Api/Mastodon/Trends/Statuses.php
src/Module/Proxy.php
src/Object/Image.php
src/Protocol/ActivityPub/Processor.php
src/Util/HTTPSignature.php

index 4843e5d37c835ed0e105c797e6d2876262e06342..299c2639947e6b32533ba0b99e930e217b1c63b0 100644 (file)
@@ -75,8 +75,8 @@ class Avatar
 
                try {
                        $fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
-               } catch (\Throwable $th) {
-                       Logger::notice('Avatar is invalid', ['avatar' => $avatar, 'error' => $th]);
+               } catch (\Exception $exception) {
+                       Logger::notice('Avatar is invalid', ['avatar' => $avatar, 'exception' => $exception]);
                        return $fields;
                }
 
index 52241e1fc8824797952eabcb7bb5704057ea9150..e6e9f4d0941b6af6086eda3d6bd6f1bb8bbf6542 100644 (file)
@@ -64,7 +64,7 @@ class Notification extends BaseFactory
                if ($Notification->targetUriId) {
                        try {
                                $status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid, $display_quotes);
-                       } catch (\Throwable $th) {
+                       } catch (\Exception $exception) {
                                $status = null;
                        }
                } else {
index 788841a9bc4248a1e1fe6eaefd7a9cb233b86f94..f653107d40478e40870d865c7e6fc2e05fe2c636 100644 (file)
@@ -266,8 +266,8 @@ class Status extends BaseFactory
                if ($is_reshare) {
                        try {
                                $reshare = $this->createFromUriId($uriId, $uid, $display_quote, false, false)->toArray();
-                       } catch (\Throwable $th) {
-                               Logger::info('Reshare not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Reshare not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                                $reshare = [];
                        }
                } else {
@@ -277,8 +277,8 @@ class Status extends BaseFactory
                if ($in_reply_status && ($item['gravity'] == Item::GRAVITY_COMMENT)) {
                        try {
                                $in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, $display_quote, false, false)->toArray();
-                       } catch (\Throwable $th) {
-                               Logger::info('Reply post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Reply post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                                $in_reply = [];
                        }
                } else {
@@ -309,8 +309,8 @@ class Status extends BaseFactory
                if (!empty($quote_id)) {
                        try {
                                $quote = $this->createFromUriId($quote_id, $uid, false, false, false)->toArray();
-                       } catch (\Throwable $th) {
-                               Logger::info('Quote not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Quote not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                                $quote = [];
                        }
                } else {
index a429a7a5d4a1303d90eac739c7b9bc9a6f7e02a2..20457b46e838c407bb78dd3c52b0bb4cc954b074 100644 (file)
@@ -202,8 +202,8 @@ class APContact
                                if (!$failed && ($curlResult->getReturnCode() == 410)) {
                                        $data = ['@context' => ActivityPub::CONTEXT, 'id' => $url, 'type' => 'Tombstone'];
                                }
-                       } catch (\Throwable $th) {
-                               Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
                                $failed = true;
                        }
 
index 64509b5d227b72e0c598eeeb4e1ab392420cd09d..f35808f050c9843986cabf3be7f3f25d6bf0c1b7 100644 (file)
@@ -2228,8 +2228,8 @@ class Contact
                                                                return;
                                                        }
                                                }
-                                       } catch (\Throwable $th) {
-                                               Logger::notice('Error fetching avatar', ['avatar' => $avatar, 'error' => $th]);
+                                       } catch (\Exception $exception) {
+                                               Logger::notice('Error fetching avatar', ['avatar' => $avatar, 'exception' => $exception]);
                                                return;
                                        }
                                } elseif (!empty($contact['blurhash'])) {
index 4ac8173799390c28f4e05ee2cbf6ca833e4d764d..dc779795117c1a524a5897e727b67122a1466ab6 100644 (file)
@@ -130,8 +130,8 @@ class Link
                        if (empty($curlResult) || !$curlResult->isSuccess()) {
                                return [];
                        }
-               } catch (\Throwable $th) {
-                       Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
+               } catch (\Exception $exception) {
+                       Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
                        return [];
                }
                $fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
index 067e3302716e71b76289775466a3352a3c652dac..463411745c94e53bc27217255595fa4b6e6dbbe1 100644 (file)
@@ -120,8 +120,8 @@ class Statuses extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 615bfc501f5031d4d51209474e268ede80bad9e2..59cf7f54a299d786bff53e49069bdbad9bf2f56d 100644 (file)
@@ -77,8 +77,8 @@ class Bookmarks extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 93c9ef243658c831f7c2054cd7a48945dc00e12d..7829f37d706c61ef12831acc2ed55a7e00322cf4 100644 (file)
@@ -79,8 +79,8 @@ class Favourited extends BaseApi
                        self::setBoundaries($item['thr-parent-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 667cd87eabca8db246bf0152817e2e1e49b33b0e..e19dfb0314deb2e275941af790b7bf45aacc8ce3 100644 (file)
@@ -117,7 +117,7 @@ class Accounts extends BaseApi
                        self::setBoundaries($member['contact-id']);
                        try {
                                $accounts[] = DI::mstdnAccount()->createFromContactId($member['contact-id'], $uid);
-                       } catch (\Throwable $th) {
+                       } catch (\Exception $exception) {
                        }
                }
                DBA::close($members);
index c35e33062bd954cad41d86e89dcda012fc80516b..69e2627682773c040812da00b98360d12c3a1727 100644 (file)
@@ -183,8 +183,8 @@ class Search extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 5efaf4930ebbe380c26c38e857917b152f0f4040..7fc179297cf98d1234853dc6732cb6b78faca931 100644 (file)
@@ -99,8 +99,8 @@ class Home extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index a8de13056ec45fb0b1367c31813453f8c63b6bf3..1e9a5810c12d571e44f871dc641d3d1c1ee1357c 100644 (file)
@@ -104,8 +104,8 @@ class ListTimeline extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 968e34dbb9f65393d0ba3e33a66f41681dd4ac5d..31750d4a5cf77ae5652b134dfd422b197775016a 100644 (file)
@@ -99,8 +99,8 @@ class PublicTimeline extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 64cd84366e6b724adf822cfb65cd2aa0c823ade2..476c9c2b94724ce51c4eb8dc557024ac14fbfa79 100644 (file)
@@ -120,8 +120,8 @@ class Tag extends BaseApi
                        self::setBoundaries($item['uri-id']);
                        try {
                                $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($items);
index 884319aa48d8f73e8d8c613c2b0d8aafa72dab6c..336f67155968c3d97532b285f96f27740fa68fe5 100644 (file)
@@ -57,8 +57,8 @@ class Statuses extends BaseApi
                while ($status = Post::fetch($statuses)) {
                        try {
                                $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);
-                       } catch (\Throwable $th) {
-                               Logger::info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'error' => $th]);
+                       } catch (\Exception $exception) {
+                               Logger::info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'exception' => $exception]);
                        }
                }
                DBA::close($statuses);
index 3f1e4b2b80ed5caa70968028261e5a3d5bdf3881..4d1e1c304b082e912ef54abe6d70756e5b96ceb6 100644 (file)
@@ -92,8 +92,8 @@ class Proxy extends BaseModule
                                self::responseError();
                                // stop.
                        }
-               } catch (\Throwable $th) {
-                       Logger::notice('Error fetching image', ['image' => $request['url'], 'error' => $th]);
+               } catch (\Exception $exception) {
+                       Logger::notice('Error fetching image', ['image' => $request['url'], 'exception' => $exception]);
                        self::responseError();
                }
 
index d6c897e88dcf392dd80a85ecaea9a383852084ab..49196a0c44fe6b1e379210330d37f4965386b996 100644 (file)
@@ -718,7 +718,7 @@ class Image
                                if ($image->isImagick()) {
                                        try {
                                                $colors = $image->image->getImagePixelColor($x, $y)->getColor();
-                                       } catch (\Throwable $th) {
+                                       } catch (\Exception $exception) {
                                                return '';
                                        }
                                        $row[] = [$colors['r'], $colors['g'], $colors['b']];
index 20736504efeeaf8cebab5b9846c8fdc5e6036374..54acca9df32b17a0a255a3c39e05bfda34b25cc4 100644 (file)
@@ -572,8 +572,8 @@ class Processor
        {
                try {
                        $curlResult = HTTPSignature::fetchRaw($url, 0);
-               } catch (\Throwable $th) {
-                       Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
+               } catch (\Exception $exception) {
+                       Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
                        return true;
                }
 
index fe623f2968a0756b17e8b7d635bc94c400c96d04..d48d02c20e2382cc178948280a25b865a9b45b70 100644 (file)
@@ -424,8 +424,8 @@ class HTTPSignature
        {
                try {
                        $curlResult = self::fetchRaw($request, $uid);
-               } catch (\Throwable $th) {
-                       Logger::notice('Error fetching url', ['url' => $request, 'error' => $th]);
+               } catch (\Exception $exception) {
+                       Logger::notice('Error fetching url', ['url' => $request, 'exception' => $exception]);
                        return [];
                }