Skip to content

Commit f694dc1

Browse files
committed
3.5
1 parent f829f27 commit f694dc1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Formatters/Json.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66

77
function format(array $diff): string
88
{
9-
return json_encode($diff, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
9+
$json = json_encode($diff, JSON_PRETTY_PRINT);
10+
11+
if (json_last_error() !== JSON_ERROR_NONE) {
12+
throw new \Exception("JSON encoding error: " . json_last_error_msg());
13+
}
14+
15+
return $json;
1016
}

0 commit comments

Comments
 (0)