0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022"""customization of Errors to be raised in PyGeo code"""
0023
0024class Error(Exception):
0025 """Base class for exceptions in this module."""
0026 pass
0027
0028
0029class Assignment_Error(Error):
0030 """Exception raised for errors in the input.
0031
0032 Attributes:
0033 expression -- input expression in which the error occurred
0034 message -- explanation of the error
0035 """
0036
0037 def __init__(self,e, value):
0038 self.value=value
0039 self.e = e
0040 def __str__(self):
0041 str = "attempted value is %s of type %s" %(self.value,type(self.value))
0042 return str
0043
0044
0045class Argument_Len_Error(Error):
0046 """Exception raised for errors in the input.
0047
0048 Attributes:
0049 expression -- input expression in which the error occurred
0050 message -- explanation of the error
0051 """
0052
0053 def __init__(self, e,args):
0054 self.e=e
0055 self.args = args
0056
0057 def __str__(self):
0058 str = "tgest"
0059 return str
0060
0061class Argument_Type_Error(Error):
0062 """Exception raised for errors in the input.
0063
0064 Attributes:
0065 expression -- input expression in which the error occurred
0066 message -- explanation of the error
0067 """
0068
0069 def __init__(self,sigs,args):
0070 self.sigs = sigs
0071 self.args = args
0072 self.goodargs=[]
0073 for a in self.sigs:
0074 argset=[]
0075 for b in a:
0076 argset.append(b.__name__)
0077 self.goodargs.append(argset)
0078
0079 def __str__(self):
0080 str=" class requires arguments derived from one of: %s arguments given: %s " %( self.goodargs,
0082 [x.__class__.__base__.__name__ for x in self.args])
0083 return str
0084
0085
0086__author__ = "Arthur Siegel <ajsiegel@optonline.com>"
0087__date__ = "Date: 2006-02-02"
0088__revision__ = "Revision: a1"
0089__url__ = "http://source.net/projects/pygeo"
0090__license__ ="GPL <http://www.opensource.org/licenses/gpl-license.php>"