8000 minor #23322 [Serializer] Improve CircularReference detection message… · symfony/symfony@71a69b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71a69b4

Browse files
committed
minor #23322 [Serializer] Improve CircularReference detection message (ScullWM)
This PR was merged into the 2.7 branch. Discussion ---------- [Serializer] Improve CircularReference detection message | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Hi, I've get a CircularReferenceException error while serializing object with nested levels. Detect a CircularReference is great, but having more information about the object that generate this exception is better. I simply suggest to add a `get_class` of the current object in the error message. Before: `A circular reference has been detected (configured limit: 1).` After (edit) `A circular reference has been detected when serializing the object of class "App\Domain\User" (configured limit: 1).` Commits ------- 3a529e3 Improve CircularReferenceException message
2 parents 77d06b5 + 3a529e3 commit 71a69b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ protected function handleCircularReference($object)
228228
return call_user_func($this->circularReferenceHandler, $object);
229229
}
230230

231-
throw new CircularReferenceException(sprintf('A circular reference has been detected (configured limit: %d).', $this->circularReferenceLimit));
231+
throw new CircularReferenceException(sprintf('A circular reference has been detected when serializing the object of class "%s" (configured limit: %d)', get_class($object), $this->circularReferenceLimit));
232232
}
233233

234234
/**

0 commit comments

Comments
 (0)
0