Raise TypeError rather than generic Exception

This commit is contained in:
Salvo 'LtWorf' Tomaselli 2015-11-18 10:38:41 +01:00
parent 521ffd5d41
commit 78a2e63e14

View File

@ -118,12 +118,12 @@ class Relation (object):
internally. internally.
Will raise an exception if they don't share the same attributes''' Will raise an exception if they don't share the same attributes'''
if not isinstance(other, relation): if not isinstance(other, relation):
raise Exception('Expected an instance of the same class') raise TypeError('Expected an instance of the same class')
elif self.header == other.header: elif self.header == other.header:
return other return other
elif self.header.sharedAttributes(other.header) == len(self.header): elif self.header.sharedAttributes(other.header) == len(self.header):
return other.projection(self.header) return other.projection(self.header)
raise Exception('Relations differ: [%s] [%s]' % ( raise TypeError('Relations differ: [%s] [%s]' % (
','.join(self.header), ','.join(other.header) ','.join(self.header), ','.join(other.header)
)) ))