Revert some changes to HttpFetchException

This commit is contained in:
Thomas Kuschan 2023-06-19 08:47:47 +02:00
parent c35080d6ce
commit 97d46f43a7
2 changed files with 5 additions and 19 deletions

View File

@ -2,22 +2,8 @@
namespace BookStack\Exceptions; namespace BookStack\Exceptions;
class HttpFetchException extends PrettyException use Exception;
class HttpFetchException extends Exception
{ {
/**
* Construct exception within BookStack\Uploads\HttpFetcher.
*/
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
if ($previous) {
$this->setDetails($previous->getMessage());
}
}
public function getStatusCode(): int
{
return 500;
}
} }

View File

@ -33,7 +33,7 @@ class UserAvatars
$avatar = $this->saveAvatarImage($user); $avatar = $this->saveAvatarImage($user);
$user->avatar()->associate($avatar); $user->avatar()->associate($avatar);
$user->save(); $user->save();
} catch (HttpFetchException $e) { } catch (Exception $e) {
Log::error('Failed to save user avatar image', ['exception' => $e]); Log::error('Failed to save user avatar image', ['exception' => $e]);
} }
} }
@ -48,7 +48,7 @@ class UserAvatars
$avatar = $this->createAvatarImageFromData($user, $imageData, $extension); $avatar = $this->createAvatarImageFromData($user, $imageData, $extension);
$user->avatar()->associate($avatar); $user->avatar()->associate($avatar);
$user->save(); $user->save();
} catch (HttpFetchException $e) { } catch (Exception $e) {
Log::error('Failed to save user avatar image', ['exception' => $e]); Log::error('Failed to save user avatar image', ['exception' => $e]);
} }
} }