Welcome Guest, Not a member yet? Register   Sign In
JSon error when database is down
#3

(09-19-2019, 09:11 PM)titounnes Wrote: before getRow(), you must check it.
$result= ..... ->getWhere(....);
if($result){
return $result->getRow();
}
//your exception code

I did wht you suggested, but got this in return

<br />
<b>Fatal error</b>: Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: &quot;Malformed UTF-8 characters, possibly incorrectly encoded&quot;. in D:\xampp\htdocs\SGAAPI\system\Format\Exceptions\FormatException.php:9
Stack trace:
#0 D:\xampp\htdocs\SGAAPI\system\Format\JSONFormatter.php(66): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Malformed UTF-8...')
#1 D:\xampp\htdocs\SGAAPI\system\API\ResponseTrait.php(386): CodeIgniter\Format\JSONFormatter-&gt;format(Array)
#2 D:\xampp\htdocs\SGAAPI\system\API\ResponseTrait.php(124): CodeIgniter\Debug\Exceptions-&gt;format(Array)
#3 D:\xampp\htdocs\SGAAPI\system\Debug\Exceptions.php(164): CodeIgniter\Debug\Exceptions-&gt;respond(Array, 500)
#4 [internal function]: CodeIgniter\Debug\Exceptions-&gt;exceptionHandler(Object(mysqli_sql_exception))
#5 {main}
thrown in <b>D:\xampp\htdocs\SGAAPI\system\Format\Exceptions\FormatException.php</b> on line <b>9</b><br />
{
"title": "ErrorException",
"type": "ErrorException",
"code": 500,
"message": "Uncaught CodeIgniter\\Format\\Exceptions\\FormatException: Failed to parse json string, error: \"Malformed UTF-8 characters, possibly incorrectly encoded\". in D:\\xampp\\htdocs\\SGAAPI\\system\\Format\\Exceptions\\FormatException.php:9\nStack trace:\n#0 D:\\xampp\\htdocs\\SGAAPI\\system\\Format\\JSONFormatter.php(66): CodeIgniter\\Format\\Exceptions\\FormatException::forInvalidJSON('Malformed UTF-8...')\n#1 D:\\xampp\\htdocs\\SGAAPI\\system\\API\\ResponseTrait.php(386): CodeIgniter\\Format\\JSONFormatter->format(Array)\n#2 D:\\xampp\\htdocs\\SGAAPI\\system\\API\\ResponseTrait.php(124): CodeIgniter\\Debug\\Exceptions->format(Array)\n#3 D:\\xampp\\htdocs\\SGAAPI\\system\\Debug\\Exceptions.php(164): CodeIgniter\\Debug\\Exceptions->respond(Array, 500)\n#4 [internal function]: CodeIgniter\\Debug\\Exceptions->exceptionHandler(Object(mysqli_sql_exception))\n#5 {main}\n thrown",
"file": "D:\\xampp\\htdocs\\SGAAPI\\system\\Format\\Exceptions\\FormatException.php",
"line": 9,
"trace": [
{
"function": "shutdownHandler",
"class": "CodeIgniter\\Debug\\Exceptions",
"type": "->",
"args": []
}
]
}
Reply


Messages In This Thread
JSon error when database is down - by ejimenez - 09-19-2019, 01:54 PM
RE: JSon error when database is down - by ejimenez - 09-20-2019, 08:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB