Source code for rics.mapping.exceptions

"""Mapping errors."""
from typing import Any, Set


[docs]class MappingError(ValueError): """Something failed to map.""" def __init__(self, msg: str) -> None: super().__init__( msg + "\n\nFor help, please refer to the " "https://rics.readthedocs.io/en/stable/documentation/mapping-primer.html page." )
[docs]class UserMappingError(MappingError): """A user-defined mapping function did something strange.""" def __init__(self, msg: str, value: Any, candidates: Set[Any]) -> None: super().__init__(msg) self.value = value self.candidates = candidates
[docs]class CardinalityError(MappingError): """Base class for cardinality issues."""
[docs]class MappingWarning(UserWarning): """Something failed to map."""
[docs]class UserMappingWarning(MappingWarning): """A user-defined mapping function did something strange."""
[docs]class BadFilterError(MappingError): """Invalid filter."""