summaryrefslogtreecommitdiff
path: root/rdflib/exceptions.py
blob: 708756ef6891e28c940940716c107ec65fdcd008 (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
"""
TODO:
"""

__all__ = [
    "Error",
    "ParserError",
    "UniquenessError",
]


from typing import Any, Optional


class Error(Exception):
    """Base class for rdflib exceptions."""

    def __init__(self, msg: Optional[str] = None):
        Exception.__init__(self, msg)
        self.msg = msg


class ParserError(Error):
    """RDF Parser error."""

    def __init__(self, msg: str):
        Error.__init__(self, msg)
        self.msg: str = msg

    def __str__(self) -> str:
        return self.msg


class UniquenessError(Error):
    """A uniqueness assumption was made in the context, and that is not true"""

    def __init__(self, values: Any):
        Error.__init__(
            self,
            "\
Uniqueness assumption is not fulfilled. Multiple values are: %s"
            % values,
        )