From 00271e741f7d4825c76b1db21a7c55b250f209e9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 1 Jun 2009 16:47:06 +0000 Subject: - Patch #458176 by c960657: improved exception handling in database layer. --- includes/database/database.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'includes/database/database.inc') diff --git a/includes/database/database.inc b/includes/database/database.inc index 60d4b415f..f1185c77a 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -595,13 +595,15 @@ abstract class DatabaseConnection extends PDO { catch (PDOException $e) { _db_check_install_needed(); if ($options['throw_exception']) { + // Add additional debug information. if ($query instanceof DatabaseStatementInterface) { - $query_string = $stmt->getQueryString(); + $e->query_string = $stmt->getQueryString(); } else { - $query_string = $query; + $e->query_string = $query; } - throw new PDOException($query_string . " - \n" . print_r($args, 1) . $e->getMessage()); + $e->args = $args; + throw $e; } return NULL; } -- cgit v1.2.3