Handle exceptions.

This commit is contained in:
Igor Barkov (iwork) 2020-06-23 14:11:31 +03:00
parent 0892729efb
commit 65be21e0ab

View File

@ -18,7 +18,8 @@ if ($msg) {
try {
db::c()->query('INSERT INTO `chat` (`uid`, `msg`) VALUES (?i, "?s")', $uid, $msg);
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "DB Error:". $e->getMessage() ."On Line:". $e->getLine();
echo "DB Error: ". $e->getMessage() . PHP_EOL;
echo "File: " . $e->getFile() . "[".$e->getLine()."]". PHP_EOL;
}
}
@ -33,7 +34,8 @@ function show_messages()
`type`
FROM `chat` ORDER BY `id` LIMIT 50');
} catch (\Krugozor\Database\Mysql\Exception $e) {
echo "DB Error:". $e->getMessage() ."On Line:". $e->getLine();
echo "DB Error: ". $e->getMessage() . PHP_EOL;
echo "File: " . $e->getFile() . "[".$e->getLine()."]". PHP_EOL;
}
while ($message = $chat->fetch_assoc()) {