-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Improve some error messages #29710
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
Labels
Cache
Good first issue
Ideal for your first contribution! (some Symfony experience may be required)
Help wanted
Issues and PRs which are looking for volunteers to complete them.
Status: Waiting feedback
Comments
That could be a nice first issue IMHO. |
Taking this for the EUFOSSA hackaton |
@javiereguiluz could you please provide a reproducer? |
E.g. when trying to cache a |
So I made a little SF command to reproduce:
And I don't have any error but a just a debug:
How could we improve this message ? |
Thank you for these details @Simperfit, I'll take a look to this and make a PR :) |
nicolas-grekas
added a commit
that referenced
this issue
May 11, 2019
… an unsupported type (Deuchnord) This PR was merged into the 4.3 branch. Discussion ---------- [Cache] Log a more readable message when trying to cache an unsupported type | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #29710 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | Improved the warning risen when trying to save something that has a non-supported type in the Simple cache. For instance, let's say the following code: ```php class TestCommand extends Command { private $cache; public function __construct(CacheInterface $cache) { parent::__construct(); $this->cache = $cache; } // ... protected function execute(InputInterface $input, OutputInterface $output) { $n = $this->cache->get('n', function () { return function () { return rand(0,10); }; }); dump($n()); } } ``` Running this code will give the following: ``` 14:32:03 WARNING [cache] Could not save key "n" in cache: the Closure type is not supported. 0 ``` Commits ------- 21ba3c0 [Cache] Log a more readable error message when saving into cache fails
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Cache
Good first issue
Ideal for your first contribution! (some Symfony experience may be required)
Help wanted
Issues and PRs which are looking for volunteers to complete them.
Status: Waiting feedback
Description
When I run some commands that make use of the cache, I get this:
No additional info is provided on
dev.log
either, so this is tricky to debug. Thanks to @nicolas-grekas this was restricted to either a serialization problem of the cached content or the use of APCu-based cache. In this case it wasn't a serialization issue because the content was a simple array.Let's check if we can add more error messages (or improve the existing ones) to explain the error in more detail and provide, if possible, solutions to fix them. Thanks!
The text was updated successfully, but these errors were encountered: