annotate demos/rpg/scripts/misc/exceptions.py @ 547:e59ece21ab3e

Item serialization will now assume some default values if they are not found in the save files. The 'spawn' console command can now spawn items with default values. Cleaned up some print statements.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 04 Jun 2010 21:01:34 +0000
parents 1afe46247ab1
children 69d50e751c9a
rev   line source
535
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 #!/usr/bin/env python
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3 # -*- coding: utf-8 -*-
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 # ####################################################################
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6 # Copyright (C) 2005-2010 by the FIFE team
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 # http://www.fifengine.net
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 # This file is part of FIFE.
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 #
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 # FIFE is free software; you can redistribute it and/or
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 # modify it under the terms of the GNU Lesser General Public
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 # License as published by the Free Software Foundation; either
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 # version 2.1 of the License, or (at your option) any later version.
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 #
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 # This library is distributed in the hope that it will be useful,
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 # Lesser General Public License for more details.
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19 #
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 # You should have received a copy of the GNU Lesser General Public
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21 # License along with this library; if not, write to the
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22 # Free Software Foundation, Inc.,
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 # ####################################################################
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25 # This is the rio de hola client for FIFE.
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 class InvalidCommandError(Exception):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 def __init__(self):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 return
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 def __str__(self):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 print "","Command not found!"
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 class ObjectNotFoundError(Exception):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 def __init__(self):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 return
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39 def __str__(self):
9fbe3dce925a Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40 print "","Object was not found!"
536
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
41
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
42 class ObjectAlreadyInSceneError(Exception):
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
43 def __init__(self):
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
44 return
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
45
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
46 def __str__(self):
1afe46247ab1 Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents: 535
diff changeset
47 print "","Object was already part of the scene!"