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:
Dag 2022-09-08 19:07:57 +02:00 committed by GitHub
parent 5578a735d9
commit 27b3d7c34e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 135 additions and 80 deletions

View file

@ -101,8 +101,8 @@ abstract class FeedExpander extends BridgeAbstract
];
$httpHeaders = ['Accept: ' . implode(', ', $mimeTypes)];
$content = getContents($url, $httpHeaders);
$rssContent = simplexml_load_string(trim($content));
// Suppress php errors. We will check return value for success.
$rssContent = @simplexml_load_string(trim($content));
if ($rssContent === false) {
throw new \Exception(sprintf('Unable to parse xml from "%s"', $url));
}