1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-30 21:30:14 +02:00

feat: embed response in http exception (#3847)

This commit is contained in:
Dag
2023-12-20 03:16:25 +01:00
committed by GitHub
parent 0c6ffbf5a4
commit 98a94855dc
5 changed files with 59 additions and 16 deletions

View File

@@ -101,19 +101,8 @@ function getContents(
$response = $response->withBody($cachedResponse->getBody());
break;
default:
$exceptionMessage = sprintf(
'%s resulted in %s %s %s',
$url,
$response->getCode(),
$response->getStatusLine(),
// If debug, include a part of the response body in the exception message
Debug::isEnabled() ? mb_substr($response->getBody(), 0, 500) : '',
);
if (CloudFlareException::isCloudFlareResponse($response)) {
throw new CloudFlareException($exceptionMessage, $response->getCode());
}
throw new HttpException(trim($exceptionMessage), $response->getCode());
$e = HttpException::fromResponse($response, $url);
throw $e;
}
if ($returnFull === true) {
// todo: return the actual response object