1
1
Fork 0

Merge pull request #5901 from annando/catch-error

Catching error when compacting doesn't work
This commit is contained in:
Hypolite Petovan 2018-10-13 10:52:18 -04:00 committed by GitHub
commit 6b2a12319c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,14 @@ class JsonLD
$jsonobj = json_decode(json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
try {
$compacted = jsonld_compact($jsonobj, $context);
}
catch (Exception $e) {
$compacted = false;
logger('compacting error:' . print_r($e, true), LOGGER_DEBUG);
}
return json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true);
}