source: mauRepo/MolesManager/trunk/src/libs/migration/exception/exceptions.py @ 8147

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/libs/migration/exception/exceptions.py@8147
Revision 8147, 2.6 KB checked in by mnagni, 8 years ago (diff)

Implementation of tickets #22390

Line 
1'''
2Created on 15 Nov 2011
3
4@author: mnagni
5'''
6
7def _migrationObjectDescription(migrationObject):
8    return "%s %s %s" % (migrationObject.doc_status, migrationObject.doc_owner, migrationObject.doc_name)
9
10class NoDBManager(Exception):
11    def __init__(self, value):
12        self.value = value
13    def __str__(self):
14        return "No DBManager has been set for %s" % (self.value) 
15   
16class NoCreationDate(Exception):
17    def __init__(self, value):
18        self.value = value
19    def __str__(self):
20        return "The resource %s has no creation date" % (self.value) 
21   
22class Moles3ObjectException(Exception):
23    def __init__(self, value):
24        self.value = value
25    def __str__(self):
26        return self.value   
27   
28class NoDocumentID(Exception):
29    def __init__(self, value):
30        self.value = value
31    def __str__(self):
32        return "The resource %s has no creation date" % (self.value)   
33
34class MigrationObjectException(Exception):
35    """
36        Raises a generic MigrationObject related exception.       
37    """
38    def __init__(self, migrationObject, comment = ''):
39        """
40            Creates a new instance
41            @param migrationObject: the MigrationObject instance that raised the error
42            @param comment:additional comment
43        """       
44        self.migrationObject = migrationObject
45        self.comment = comment
46    def __str__(self):
47        return "Error on migration object %s " % (_migrationObjectDescription(self.migrationObject))
48
49class NoAssociatedAuthor(MigrationObjectException):
50    """
51        Raises a missing associatedAuthor exception.       
52    """   
53    def __init__(self, author, migrationObject = None, comment = ''):
54        self.author = author
55        super(NoAssociatedAuthor, self).__init__(migrationObject, comment = '')
56    def __str__(self):
57        return "The MigrationObject %s has no author mapping for %s" % (_migrationObjectDescription(self.migrationObject), self.author)       
58
59class NoAssociatedDeployments(Exception):
60    def __init__(self, data_entityMigration, deploymentName):
61        self._migrationObject = data_entityMigration
62        self._deploymentName = deploymentName       
63        super(NoAssociatedDeployments, self).__init__()
64    def __str__(self):
65        return "The DataEntity %s has no associated deployment named %s" % (_migrationObjectDescription(self.migrationObject), self._deploymentName)
66   
67class NoDataLineage(MigrationObjectException):
68    """
69        Raises a missing dataLineage exception.       
70    """   
71    def __init__(self, migrationObject, comment = ''):       
72        super(NoDataLineage, self).__init__(migrationObject, comment = '')
Note: See TracBrowser for help on using the repository browser.