Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: When in DataSource Exception -> AbstractServiceController -> call to logThrowable() on null #3858

Closed
1 task done
mhsdesign opened this issue Aug 15, 2022 · 0 comments
Labels

Comments

@mhsdesign
Copy link
Member

Is there an existing issue for this?

  • 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
@mhsdesign mhsdesign added the Bug label Aug 15, 2022
mhsdesign added a commit to mhsdesign/neos-development-collection that referenced this issue Oct 22, 2022
… logThrowable() on null

ThrowableStorage is not injected

this seems to be an inheritance problem in combination with dependency injection

in the extended ActionController

we find this

```php
    /**
     * @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
```php
  /**
   * @flow\Inject
   * @var ThrowableStorageInterface
   */
  protected $throwableStorage;
```

solutions are:

- fix the flow DI? (assuming this is a issue)
- rename the variable (what id did now)
- use also AbstractServiceController::injectThrowableStorage / not the @flow\Inject annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant