2
0
Fork 0
textout/textoutpc/exceptions.py

33 lines
952 B
Python

#!/usr/bin/env python
# *****************************************************************************
# Copyright (C) 2023 Thomas Touhey <thomas@touhey.fr>
# This file is part of the textoutpc project, which is MIT-licensed.
# *****************************************************************************
"""Exceptions for textoutpc."""
from __future__ import annotations
class TagValidationError(Exception):
"""A tag validation has failed for an unknown error."""
__slots__ = ("message", "args", "kwargs")
def __init__(self, message: str = "", *args, **kwargs):
self.message = message
self.args = args
self.kwargs = kwargs
class MissingValue(TagValidationError):
"""A value should have been provided, and wasn't."""
class UnexpectedValue(TagValidationError):
"""No value should have been provided, but one was."""
class InvalidValue(TagValidationError):
"""An invalid value was provided."""