Improve syntax error reporting

In some cases the error information is not enough to debug it.

Before:

syntax error, unexpected '<<' (T_SL)
/var/www/html/lib/private/AppFramework/Http/Dispatcher.php
158

After:

syntax error, unexpected '<<' (T_SL) in file '/var/www/html/apps/groupfolders/lib/Mount/GroupFolderStorage.php' line 88
/var/www/html/lib/private/AppFramework/Http/Dispatcher.php
158

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2021-09-21 10:28:26 +02:00
parent 9f4b640e92
commit e1c4b648d1
No known key found for this signature in database
GPG key ID: 06B35D38387B67BE

View file

@ -155,7 +155,7 @@ class Dispatcher {
$response = $this->middlewareDispatcher->afterException(
$controller, $methodName, $exception);
} catch (\Throwable $throwable) {
$exception = new \Exception($throwable->getMessage(), $throwable->getCode(), $throwable);
$exception = new \Exception($throwable->getMessage() . ' in file \'' . $throwable->getFile() . '\' line ' . $throwable->getLine(), $throwable->getCode(), $throwable);
$response = $this->middlewareDispatcher->afterException(
$controller, $methodName, $exception);
}