Creates a new SelectorError instance.
Selector error construction options including the
optional selectorString and parsedSelector diagnostic fields.
Defaults: code = ERR_SELECTOR_INVALID, retryable = false.
import { SelectorError } from '#core/errors/selector-error.js';
const error = new SelectorError({
message: 'Invalid selector syntax: missing control type',
attempted: 'Parse selector: ui5=sap.m.Button#save',
selectorString: 'ui5=sap.m.Button#save',
suggestions: ['Use format: controlType=sap.m.Button'],
});
ReadonlyattemptedReadonlycodeReadonlydetailsReadonlyparsedReadonlyretryableReadonlyselectorReadonlyseverityReadonlysuggestionsReadonlytimestampReturns structured context for AI agents to reason about the selector failure.
AI-friendly context object with selector diagnostic fields.
Serializes the error to a plain JSON-safe object.
Base serialized fields plus selectorString and parsedSelector.
Error subclass for selector parsing/resolution failures.
Remarks
Thrown when a UI5 selector string has invalid syntax, matches multiple controls when a single match is expected, or cannot be tokenized by the selector parser. Includes the raw
selectorStringand, when available, the partiallyparsedSelectorfor diagnostic inspection.Failure Mode
Invalid syntax — selector string does not match expected format
Failure Mode
Ambiguous match — selector matches multiple controls when single expected
Failure Mode
Parse failure — selector expression could not be tokenized
Ai Context
Selector correction hints for AI agents — suggestedSelector field provides alternatives
Example