From 65be21e0ab341d61ee09e5bf28bd68311e278d40 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Tue, 23 Jun 2020 14:11:31 +0300 Subject: [PATCH] Handle exceptions. --- chat.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chat.php b/chat.php index 39d3f50..b2119bd 100644 --- a/chat.php +++ b/chat.php @@ -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()) {