1"""
2The SelectorSyntaxError the CSS selector engine raises on a malformed selector.
3
4Every selector-parse path shares this one type: the native :meth:`~turbohtml.Node.select`,
5:meth:`~turbohtml.Node.matches`, and :meth:`~turbohtml.Node.closest`; the soupsieve-shaped
6:mod:`turbohtml.query` matching facade; and the :func:`turbohtml.convert.css_to_xpath` translator. The
7engine raises it from C, so importing this module registers the type with the core.
8"""
9
10from __future__ import annotations
11
12from turbohtml._html import _register_selector_error
13
14__all__ = ["SelectorSyntaxError"]
15
16
17class SelectorSyntaxError(ValueError):
18 """
19 A CSS selector could not be parsed.
20
21 Raised by :meth:`~turbohtml.Node.select`, :meth:`~turbohtml.Node.matches`, and
22 :meth:`~turbohtml.Node.closest`, by the :mod:`turbohtml.query` matching helpers, and by
23 :func:`turbohtml.convert.css_to_xpath`. It subclasses :class:`ValueError`, so code catching
24 ``ValueError`` keeps working while a soupsieve port can catch it by its soupsieve name.
25 """
26
27
28_register_selector_error(SelectorSyntaxError)