Source code for rdflib.exceptions

"""
TODO:
"""

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


from typing import Any, Optional


[docs]class Error(Exception): """Base class for rdflib exceptions."""
[docs] def __init__(self, msg: Optional[str] = None): Exception.__init__(self, msg) self.msg = msg
[docs]class ParserError(Error): """RDF Parser error."""
[docs] def __init__(self, msg: str): Error.__init__(self, msg) self.msg: str = msg
[docs] def __str__(self) -> str: return self.msg
[docs]class UniquenessError(Error): """A uniqueness assumption was made in the context, and that is not true"""
[docs] def __init__(self, values: Any): Error.__init__( self, "\ Uniqueness assumption is not fulfilled. Multiple values are: %s" % values, )