Plain is headed towards 1.0! Subscribe for development updates →

 1from plain.models.db import DatabaseError
 2
 3
 4class AmbiguityError(Exception):
 5    """More than one migration matches a name prefix."""
 6
 7    pass
 8
 9
10class BadMigrationError(Exception):
11    """There's a bad migration (unreadable/bad format/etc.)."""
12
13    pass
14
15
16class CircularDependencyError(Exception):
17    """There's an impossible-to-resolve circular dependency."""
18
19    pass
20
21
22class InconsistentMigrationHistory(Exception):
23    """An applied migration has some of its dependencies not applied."""
24
25    pass
26
27
28class InvalidBasesError(ValueError):
29    """A model's base classes can't be resolved."""
30
31    pass
32
33
34class IrreversibleError(RuntimeError):
35    """An irreversible migration is about to be reversed."""
36
37    pass
38
39
40class NodeNotFoundError(LookupError):
41    """An attempt on a node is made that is not available in the graph."""
42
43    def __init__(self, message, node, origin=None):
44        self.message = message
45        self.origin = origin
46        self.node = node
47
48    def __str__(self):
49        return self.message
50
51    def __repr__(self):
52        return f"NodeNotFoundError({self.node!r})"
53
54
55class MigrationSchemaMissing(DatabaseError):
56    pass
57
58
59class InvalidMigrationPlan(ValueError):
60    pass