Catching error when compacting doesn't work
This commit is contained in:
parent
af8a383be0
commit
d23386f9b2
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue