Modify HttpFetchException handle to log exception

Within the flow of HttpFetchException, the actual exception from curl is preserved and logged. Make HttpFetchException a pretty exception for when it is shown to users.
This commit is contained in:
Thomas Kuschan
2023-06-14 14:09:52 +02:00
parent ec775aec02
commit c35080d6ce
4 changed files with 50 additions and 10 deletions

View File

@@ -2,8 +2,22 @@
namespace BookStack\Exceptions;
use Exception;
class HttpFetchException extends Exception
class HttpFetchException extends PrettyException
{
/**
* 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;
}
}