mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-05 16:17:28 +02:00
feat: improve logging and error handling (#2994)
* feat: improve logging and error handling * trim absolute path from file name * fix: suppress php errors from xml parsing * fix: respect the error reporting level in the custom error handler * feat: dont log error which is produced by bots * ignore error about invalid bridge name * upgrade bridge exception from warning to error * remove remnants of using phps builin error handler * move responsibility of printing php error from logger to error handler * feat: include url in log record context * fix: always include url in log record contect Also ignore more non-interesting exceptions. * more verbose httpexception * fix * fix
This commit is contained in:
@@ -12,6 +12,7 @@ const RSSBRIDGE_HTTP_STATUS_CODES = [
|
||||
'205' => 'Reset Content',
|
||||
'206' => 'Partial Content',
|
||||
'300' => 'Multiple Choices',
|
||||
'301' => 'Moved Permanently',
|
||||
'302' => 'Found',
|
||||
'303' => 'See Other',
|
||||
'304' => 'Not Modified',
|
||||
@@ -136,7 +137,8 @@ function getContents(
|
||||
default:
|
||||
throw new HttpException(
|
||||
sprintf(
|
||||
'%s %s',
|
||||
'%s resulted in `%s %s`',
|
||||
$url,
|
||||
$result['code'],
|
||||
RSSBRIDGE_HTTP_STATUS_CODES[$result['code']] ?? ''
|
||||
),
|
||||
@@ -231,7 +233,13 @@ function _http_request(string $url, array $config = []): array
|
||||
}
|
||||
if ($attempts > $config['retries']) {
|
||||
// Finally give up
|
||||
throw new HttpException(sprintf('%s (%s)', curl_error($ch), curl_errno($ch)));
|
||||
throw new HttpException(sprintf(
|
||||
'cURL error %s: %s (%s) for %s',
|
||||
curl_error($ch),
|
||||
curl_errno($ch),
|
||||
'https://curl.haxx.se/libcurl/c/libcurl-errors.html',
|
||||
$url
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user