From 6ffc0d2042adb894d7974201a5b79feb5787fbd0 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Wed, 9 Jul 2014 17:46:21 +0200 Subject: [PATCH] Error messages --- snapporder/lib/functions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snapporder/lib/functions.php b/snapporder/lib/functions.php index 86871ba..cd02a16 100644 --- a/snapporder/lib/functions.php +++ b/snapporder/lib/functions.php @@ -44,7 +44,7 @@ function add_user($data) { $res = $conn->execute($sth, $values); if( DB::isError($res) ) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } $user_id = get_user_id_by_username($data['username']); @@ -57,7 +57,7 @@ function add_user($data) { $res = $conn->execute($sth, $values); if( DB::isError($res) ) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } log_userupdate($user_id, "User registered."); // for legacy @@ -82,7 +82,7 @@ function get_user($user_id) { $sql = "SELECT ".implode($cols, ",").",$sql_group_ids,$sql_is_member FROM din_user AS users LEFT JOIN din_usergrouprelationship AS ug ON users.id=ug.user_id WHERE users.id=$user_id GROUP BY users.id"; $res = $conn->query($sql); if( DB::isError($res) ) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } if($res->numRows() === 0) { return false; @@ -123,7 +123,7 @@ function get_user_id_by_username($username) { $sql = "SELECT id FROM din_user WHERE username='$username'"; $res = $conn->query($sql); if( DB::isError($res) ) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } if( $res->numRows() === 0 ) { return false; @@ -230,7 +230,7 @@ function institutions($output=true) { $sql = "SELECT * FROM studiesteder"; $res = $conn->getAll($sql); if( DB::isError($res) ) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } $institutions = $res; @@ -317,7 +317,7 @@ function update_user($data) { $res = $conn->query($sql); if (DB::isError($res)) { - throw new InsideDatabaseException($res->toString); + throw new InsideDatabaseException($res->getMessage()); } return true; }