Use "Exception"
This commit is contained in:
parent
2b513a48c7
commit
6e3602591d
|
@ -75,8 +75,8 @@ class Avatar
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
|
$fetchResult = HTTPSignature::fetchRaw($avatar, 0, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Avatar is invalid', ['avatar' => $avatar, 'error' => $th]);
|
Logger::notice('Avatar is invalid', ['avatar' => $avatar, 'exception' => $exception]);
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Notification extends BaseFactory
|
||||||
if ($Notification->targetUriId) {
|
if ($Notification->targetUriId) {
|
||||||
try {
|
try {
|
||||||
$status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid, $display_quotes);
|
$status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
$status = null;
|
$status = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -266,8 +266,8 @@ class Status extends BaseFactory
|
||||||
if ($is_reshare) {
|
if ($is_reshare) {
|
||||||
try {
|
try {
|
||||||
$reshare = $this->createFromUriId($uriId, $uid, $display_quote, false, false)->toArray();
|
$reshare = $this->createFromUriId($uriId, $uid, $display_quote, false, false)->toArray();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Reshare not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Reshare not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
$reshare = [];
|
$reshare = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -277,8 +277,8 @@ class Status extends BaseFactory
|
||||||
if ($in_reply_status && ($item['gravity'] == Item::GRAVITY_COMMENT)) {
|
if ($in_reply_status && ($item['gravity'] == Item::GRAVITY_COMMENT)) {
|
||||||
try {
|
try {
|
||||||
$in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, $display_quote, false, false)->toArray();
|
$in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, $display_quote, false, false)->toArray();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Reply post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Reply post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
$in_reply = [];
|
$in_reply = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -309,8 +309,8 @@ class Status extends BaseFactory
|
||||||
if (!empty($quote_id)) {
|
if (!empty($quote_id)) {
|
||||||
try {
|
try {
|
||||||
$quote = $this->createFromUriId($quote_id, $uid, false, false, false)->toArray();
|
$quote = $this->createFromUriId($quote_id, $uid, false, false, false)->toArray();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Quote not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Quote not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
$quote = [];
|
$quote = [];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -202,8 +202,8 @@ class APContact
|
||||||
if (!$failed && ($curlResult->getReturnCode() == 410)) {
|
if (!$failed && ($curlResult->getReturnCode() == 410)) {
|
||||||
$data = ['@context' => ActivityPub::CONTEXT, 'id' => $url, 'type' => 'Tombstone'];
|
$data = ['@context' => ActivityPub::CONTEXT, 'id' => $url, 'type' => 'Tombstone'];
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
|
Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
|
||||||
$failed = true;
|
$failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2228,8 +2228,8 @@ class Contact
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching avatar', ['avatar' => $avatar, 'error' => $th]);
|
Logger::notice('Error fetching avatar', ['avatar' => $avatar, 'exception' => $exception]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} elseif (!empty($contact['blurhash'])) {
|
} elseif (!empty($contact['blurhash'])) {
|
||||||
|
|
|
@ -130,8 +130,8 @@ class Link
|
||||||
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
|
Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
|
$fields = ['mimetype' => $curlResult->getHeader('Content-Type')[0]];
|
||||||
|
|
|
@ -120,8 +120,8 @@ class Statuses extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -77,8 +77,8 @@ class Bookmarks extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -79,8 +79,8 @@ class Favourited extends BaseApi
|
||||||
self::setBoundaries($item['thr-parent-id']);
|
self::setBoundaries($item['thr-parent-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Accounts extends BaseApi
|
||||||
self::setBoundaries($member['contact-id']);
|
self::setBoundaries($member['contact-id']);
|
||||||
try {
|
try {
|
||||||
$accounts[] = DI::mstdnAccount()->createFromContactId($member['contact-id'], $uid);
|
$accounts[] = DI::mstdnAccount()->createFromContactId($member['contact-id'], $uid);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($members);
|
DBA::close($members);
|
||||||
|
|
|
@ -183,8 +183,8 @@ class Search extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -99,8 +99,8 @@ class Home extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -104,8 +104,8 @@ class ListTimeline extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -99,8 +99,8 @@ class PublicTimeline extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -120,8 +120,8 @@ class Tag extends BaseApi
|
||||||
self::setBoundaries($item['uri-id']);
|
self::setBoundaries($item['uri-id']);
|
||||||
try {
|
try {
|
||||||
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
$statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($items);
|
DBA::close($items);
|
||||||
|
|
|
@ -57,8 +57,8 @@ class Statuses extends BaseApi
|
||||||
while ($status = Post::fetch($statuses)) {
|
while ($status = Post::fetch($statuses)) {
|
||||||
try {
|
try {
|
||||||
$trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);
|
$trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'error' => $th]);
|
Logger::info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'exception' => $exception]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBA::close($statuses);
|
DBA::close($statuses);
|
||||||
|
|
|
@ -92,8 +92,8 @@ class Proxy extends BaseModule
|
||||||
self::responseError();
|
self::responseError();
|
||||||
// stop.
|
// stop.
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching image', ['image' => $request['url'], 'error' => $th]);
|
Logger::notice('Error fetching image', ['image' => $request['url'], 'exception' => $exception]);
|
||||||
self::responseError();
|
self::responseError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -718,7 +718,7 @@ class Image
|
||||||
if ($image->isImagick()) {
|
if ($image->isImagick()) {
|
||||||
try {
|
try {
|
||||||
$colors = $image->image->getImagePixelColor($x, $y)->getColor();
|
$colors = $image->image->getImagePixelColor($x, $y)->getColor();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$row[] = [$colors['r'], $colors['g'], $colors['b']];
|
$row[] = [$colors['r'], $colors['g'], $colors['b']];
|
||||||
|
|
|
@ -572,8 +572,8 @@ class Processor
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$curlResult = HTTPSignature::fetchRaw($url, 0);
|
$curlResult = HTTPSignature::fetchRaw($url, 0);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching url', ['url' => $url, 'error' => $th]);
|
Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -424,8 +424,8 @@ class HTTPSignature
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$curlResult = self::fetchRaw($request, $uid);
|
$curlResult = self::fetchRaw($request, $uid);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Exception $exception) {
|
||||||
Logger::notice('Error fetching url', ['url' => $request, 'error' => $th]);
|
Logger::notice('Error fetching url', ['url' => $request, 'exception' => $exception]);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user