lib/service/MicroTemplateService.js
function tryParseSelector(rawSelector) {
    try {
        return esquery.parse(rawSelector.replace(/:exit$/u, ""))
    } catch (err) {
        if (typeof err.offset === "number") {
            throw new Error(
                `Syntax error in selector "${rawSelector}" at position ${
                    err.offset
                }: ${err.message}`
            )
        }
        throw err
    }
}
function tryParseSelector(rawSelector) {
    try {
        return esquery.parse(rawSelector.replace(/:exit$/u, ""))
    } catch (err) {
        if (typeof err.offset === "number") {
            throw new Error(
                `Syntax error in selector "${rawSelector}" at position ${
                    err.offset
                }: ${err.message}`
            )
        }
        throw err
    }
}
function tryParseSelector ( rawSelector ) { try { return esquery . parse ( rawSelector . replace ( / :exit$ / u , "" ) ) } catch ( err ) { if ( typeof err . offset === "number" ) { throw new Error ( ` ${ rawSelector } ${ err . offset } ${ err . message } ` ) } throw err } }
Parses a raw selector string, and throws a useful error if parsing fails.
@param {string} rawSelector A raw AST selector
@returns {Selector} An object (from esquery) describing the matching behavior of this selector
@throws An error if the selector is invalid
Parses a raw selector string and throws a useful error if parsing fails .