| 1 |
from django.db import DatabaseError |
| 2 |
|
| 3 |
|
| 4 |
class AmbiguityError(Exception): |
| 5 |
"""More than one migration matches a name prefix.""" |
| 6 |
|
| 7 |
pass |
| 8 |
|
| 9 |
|
| 10 |
class BadMigrationError(Exception): |
| 11 |
"""There's a bad migration (unreadable/bad format/etc.).""" |
| 12 |
|
| 13 |
pass |
| 14 |
|
| 15 |
|
| 16 |
class CircularDependencyError(Exception): |
| 17 |
"""There's an impossible-to-resolve circular dependency.""" |
| 18 |
|
| 19 |
pass |
| 20 |
|
| 21 |
|
| 22 |
class InconsistentMigrationHistory(Exception): |
| 23 |
"""An applied migration has some of its dependencies not applied.""" |
| 24 |
|
| 25 |
pass |
| 26 |
|
| 27 |
|
| 28 |
class InvalidBasesError(ValueError): |
| 29 |
"""A model's base classes can't be resolved.""" |
| 30 |
|
| 31 |
pass |
| 32 |
|
| 33 |
|
| 34 |
class IrreversibleError(RuntimeError): |
| 35 |
"""An irreversible migration is about to be reversed.""" |
| 36 |
|
| 37 |
pass |
| 38 |
|
| 39 |
|
| 40 |
class 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 "NodeNotFoundError(%r)" % (self.node,) |
| 53 |
|
| 54 |
|
| 55 |
class MigrationSchemaMissing(DatabaseError): |
| 56 |
pass |
| 57 |
|
| 58 |
|
| 59 |
class InvalidMigrationPlan(ValueError): |
| 60 |
pass |