summaryrefslogtreecommitdiffstats
path: root/treelib/exceptions.py
blob: fc955c58b09834bd55c0832b8b428f44b4de4d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class NodePropertyError(Exception):
    """Basic Node attribute error"""

    pass


class NodeIDAbsentError(NodePropertyError):
    """Exception throwed if a node's identifier is unknown"""

    pass


class NodePropertyAbsentError(NodePropertyError):
    """Exception throwed if a node's data property is not specified"""

    pass


class MultipleRootError(Exception):
    """Exception throwed if more than one root exists in a tree."""

    pass


class DuplicatedNodeIdError(Exception):
    """Exception throwed if an identifier already exists in a tree."""

    pass


class LinkPastRootNodeError(Exception):
    """
    Exception throwed in Tree.link_past_node() if one attempts
    to "link past" the root node of a tree.
    """

    pass


class InvalidLevelNumber(Exception):
    pass


class LoopError(Exception):
    """
    Exception thrown if trying to move node B to node A's position
    while A is B's ancestor.
    """

    pass