"""Exceptions in XGrammar."""
from typing import TYPE_CHECKING
from .base import _core
if TYPE_CHECKING or isinstance(_core, str):
[docs] class DeserializeVersionError(RuntimeError):
"""Raised when the serialization format is invalid."""
[docs] class InvalidJSONError(RuntimeError):
"""Raised when the JSON is invalid."""
[docs] class InvalidStructuralTagError(RuntimeError):
"""Raised when the structural tag is invalid."""
else:
# real implementation here
DeserializeFormatError = _core.exception.DeserializeFormatError
DeserializeVersionError = _core.exception.DeserializeVersionError
InvalidJSONError = _core.exception.InvalidJSONError
InvalidStructuralTagError = _core.exception.InvalidStructuralTagError