gnome-games r7641 - in branches/gnome-2-22/glchess: . src/lib src/lib/chess
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7641 - in branches/gnome-2-22/glchess: . src/lib src/lib/chess
- Date: Sat, 10 May 2008 07:01:38 +0100 (BST)
Author: rancell
Date: Sat May 10 06:01:38 2008
New Revision: 7641
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7641&view=rev
Log:
Handle unknown tokens (Bug #526252), Correctly catch and display PGN errors
Modified:
branches/gnome-2-22/glchess/ChangeLog
branches/gnome-2-22/glchess/src/lib/chess/pgn.py
branches/gnome-2-22/glchess/src/lib/main.py
Modified: branches/gnome-2-22/glchess/src/lib/chess/pgn.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/chess/pgn.py (original)
+++ branches/gnome-2-22/glchess/src/lib/chess/pgn.py Sat May 10 06:01:38 2008
@@ -286,9 +286,12 @@
self.comment = ''
break
else:
- tokenType = self.tokens[text[0]]
+ try:
+ tokenType = self.tokens[text[0]]
+ except KeyError:
+ raise Error("Unknown token %s" % repr(text))
self.parseToken(tokenType, text)
-
+
if self.comment is None:
return True
Modified: branches/gnome-2-22/glchess/src/lib/main.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/main.py (original)
+++ branches/gnome-2-22/glchess/src/lib/main.py Sat May 10 06:01:38 2008
@@ -378,7 +378,7 @@
try:
p = chess.pgn.PGN(path, 1)
except chess.pgn.Error, e:
- return e.description
+ return e.message
except IOError, e:
return e.strerror
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]