Package geometry :: Package manifolds :: Module exceptions
[hide private]
[frames] | no frames]

Source Code for Module geometry.manifolds.exceptions

 1  from geometry.formatting import formatm 
 2   
 3   
4 -class DoesNotBelong(Exception):
5 ''' Exception thrown when a point does not belong 6 to a certain manifold *M*. '''
7 - def __init__(self, M, point, e, context=None):
8 self.M = M 9 self.point = point 10 self.e = '%s' % e 11 self.context = context
12
13 - def __str__(self):
14 try: 15 s = '' 16 if self.context is not None: 17 s += '%s\n' % self.context 18 s += ('%s: The point does not belong here:\n%s' % 19 (self.M, formatm('p', self.point))) 20 s += self.e 21 return s 22 except Exception as e: 23 return "(%s) %s: %s" % (e, self.M, self.point)
24