neos-development-collection
neos-development-collection copied to clipboard
BUG: When in DataSource Exception -> AbstractServiceController -> call to logThrowable() on null
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
When there is an Exception in a DataSource, the DataSourceController which extends the AbstractServiceController tries to handle the Exception in AbstractServiceController::processRequest. As last step
$this->logger->error($this->throwableStorage->logThrowable($exception), LogEnvironment::fromMethodName(__METHOD__));
is called.
This results in the Error
Call to a member function logThrowable() on null
Exception Code | 0
Exception Type | Error
Thrown in File | /tmp/Flow/Development/SubContextDdev/Cache/Code/Flow_Object_Classes/Neos_Neos_Service_Controller_AbstractServiceController.php
Line | 101
Original File | Packages/Application/Neos.Neos/Classes/Service/Controller/AbstractServiceController.php
Expected Behavior
We see the actual Error (as Json or in the UI) and the Exception is logged sucessfully via $throwableStorage->logThrowable().
Steps To Reproduce
Throw an Error in a DataSource and use it via the DataSourceController / Neos.Ui
Environment
- Flow: 7.3
- Neos: 7.3
- PHP: 8.1
Anything else?
Solution
this seems to be an inheritance problem in combination with dependency injection
in the extended ActionController
we find this
/**
* @var ThrowableStorageInterface
*/
private $throwableStorage;
/**
* Injects the throwable storage.
*
* @param ThrowableStorageInterface $throwableStorage
* @return void
*/
public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage)
{
$this->throwableStorage = $throwableStorage;
}
and that doesnt seem to behave as expected in combination with the code in the AbstractServiceController
/**
* @Flow\Inject
* @var ThrowableStorageInterface
*/
protected $throwableStorage;
so we can do 2 things (assuming that its not a Flow DI Issue pinging @robertlemke )
- rename the variable
- use also AbstractServiceController::injectThrowableStorage / not the @Flow\Inject annotation