mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 17:44:38 +09:00
Record error when JSON encoding fails in JSONDisplayHandler
This commit is contained in:
parent
ce11578617
commit
f0c27773c4
1 changed files with 10 additions and 1 deletions
|
|
@ -15,7 +15,16 @@ class JSONDisplayHandler
|
||||||
$variables['message'] = $oModule->getMessage();
|
$variables['message'] = $oModule->getMessage();
|
||||||
|
|
||||||
self::_convertCompat($variables, Context::getRequestMethod());
|
self::_convertCompat($variables, Context::getRequestMethod());
|
||||||
return json_encode($variables) . "\n";
|
$result = json_encode($variables) . "\n";
|
||||||
|
if (json_last_error() != \JSON_ERROR_NONE)
|
||||||
|
{
|
||||||
|
trigger_error('JSON encoding error: ' . json_last_error_msg(), E_USER_WARNING);
|
||||||
|
return json_encode([
|
||||||
|
'error' => -1,
|
||||||
|
'message' => 'JSON encoding error',
|
||||||
|
]) . "\n";
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue