From 1c4883edbab3f6a59598f54c894f62fa8590cf28 Mon Sep 17 00:00:00 2001 From: simo Date: Sun, 18 Dec 2005 00:17:58 +0000 Subject: More descriptive tupkg error message Catch sql server connection death --- tupkg/server/tupkgs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tupkg/server') diff --git a/tupkg/server/tupkgs b/tupkg/server/tupkgs index ca9ab26..05d6024 100755 --- a/tupkg/server/tupkgs +++ b/tupkg/server/tupkgs @@ -119,11 +119,15 @@ class ClientSocket(threading.Thread): m = md5.new() m.update(authdata['password'][0]) encpw = m.hexdigest() - q.execute("SELECT ID, Suspended, AccountTypeID FROM Users WHERE Username = '"+ - MySQLdb.escape_string(authdata['username'][0])+ - "' AND Passwd = '"+ - MySQLdb.escape_string(encpw)+ - "'") + try: + q.execute("SELECT ID, Suspended, AccountTypeID FROM Users WHERE Username = '"+ + MySQLdb.escape_string(authdata['username'][0])+ + "' AND Passwd = '"+ + MySQLdb.escape_string(encpw)+ + "'") + except MySQLdb.OperationalError: + self.sendMsg("result=SQLERR") + return 0 if q.rowcount == 0: self.sendMsg("result=FAIL") return 0 -- cgit v1.2.3-70-g09d2