Skip to content

Commit 7277340

Browse files
author
Jérôme Deuchnord
committed
Log a more readable message when trying to cache an unsupported type
1 parent ecfccc6 commit 7277340

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ public function commit()
164164
$ok = false;
165165
$v = $values[$id];
166166
$type = \is_object($v) ? \get_class($v) : \gettype($v);
167-
CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]);
167+
$this->logger->warning(\sprintf(
168+
'Could not save key "%s" in cache: the %s type is not supported.',
169+
$id,
170+
$type
171+
));
172+
$this->logger->warning('Tip: check that the type you are trying to save is cacheable: https://symfony.com/doc/current/components/cache.html#available-cache-adapters, or create your own adapter.');
168173
}
169174
} else {
170175
foreach ($values as $id => $v) {

0 commit comments

Comments
 (0)