We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
$previous
1 parent 054cebb commit b9fd914Copy full SHA for b9fd914
lib/Doctrine/ODM/MongoDB/DocumentNotFoundException.php
@@ -4,6 +4,8 @@
4
5
namespace Doctrine\ODM\MongoDB;
6
7
+use JsonException;
8
+
9
use function json_encode;
10
use function sprintf;
11
@@ -20,10 +22,15 @@ final class DocumentNotFoundException extends MongoDBException
20
22
*/
21
23
public static function documentNotFound(string $className, $identifier): self
24
{
25
+ try {
26
+ $id = json_encode($identifier, JSON_THROW_ON_ERROR);
27
+ } catch (JsonException $e) {
28
+ }
29
30
return new self(sprintf(
31
'The "%s" document with identifier %s could not be found.',
32
$className,
- json_encode($identifier, JSON_THROW_ON_ERROR)
- ));
33
+ $id ?? false,
34
+ ), 0, $e ?? null);
35
}
36
0 commit comments