From bc0b635691223bdcbe0e58f14b9fef3da1406e40 Mon Sep 17 00:00:00 2001
From: pixel <pixel>
Date: Wed, 6 Aug 2008 12:07:16 +0000
Subject: Small change to avoid exceptions to go a level too high...

---
 lib/LuaSQL.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 'lib')

diff --git a/lib/LuaSQL.cc b/lib/LuaSQL.cc
index 46ba7d3..5b25f84 100644
--- a/lib/LuaSQL.cc
+++ b/lib/LuaSQL.cc
@@ -17,7 +17,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/* $Id: LuaSQL.cc,v 1.11 2007-07-27 10:05:52 pixel Exp $ */
+/* $Id: LuaSQL.cc,v 1.12 2008-08-06 12:07:16 pixel Exp $ */
 
 #ifdef _WIN32
 #include <winsock.h>
@@ -155,8 +155,13 @@ int sLua_SQLConnection::SQLConnection_proceed_statics(Lua * L, int n, int caller
 	if (n >= 7)
 	    cflags = L->tonumber(7);
         {
-            LuaSQLConnection c(new SQLConnection(host, user, passwd, db, port, socket, cflags));
-            c.pushdestruct(L);
+            try {
+                LuaSQLConnection c(new SQLConnection(host, user, passwd, db, port, socket, cflags));
+                c.pushdestruct(L);
+            }
+            catch (GeneralException e) {
+                L->error("Unable to connect to MySQL server: " + String(e.GetMsg()));
+            }
         }
         break;
     }
-- 
cgit v1.2.3