Praman — Agent-First SAP UI5 Test Automation Plugin - v1.2.0
    Preparing search index...

    Class SelectorError

    Error subclass for selector parsing/resolution failures.

    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 selectorString and, when available, the partially parsedSelector for diagnostic inspection.

    Invalid syntax — selector string does not match expected format

    Ambiguous match — selector matches multiple controls when single expected

    Parse failure — selector expression could not be tokenized

    Selector correction hints for AI agents — suggestedSelector field provides alternatives

    const error = new SelectorError({
    message: 'Ambiguous selector matched 3 controls',
    attempted: 'Resolve selector to single control',
    code: 'ERR_SELECTOR_AMBIGUOUS',
    selectorString: 'sap.m.Button',
    });

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new SelectorError instance.

      Parameters

      • options: SelectorErrorOptions

        Selector error construction options including the optional selectorString and parsedSelector diagnostic fields. Defaults: code = ERR_SELECTOR_INVALID, retryable = false.

      Returns SelectorError

      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'],
      });

    Properties

    attempted: string
    code: ErrorCode
    details: Readonly<Record<string, unknown>>
    parsedSelector: UI5Selector | undefined
    retryable: boolean
    selectorString: string | undefined
    severity: "error" | "info" | "warning"
    suggestions: readonly string[]
    timestamp: string

    Methods

    • Returns structured context for AI agents to reason about the selector failure.

      Returns AIErrorContext & {
          parsedSelector: UI5Selector | undefined;
          selectorString: string | undefined;
      }

      AI-friendly context object with selector diagnostic fields.

      Extends the base AI context with selectorString and parsedSelector so AI agents can suggest corrected selectors.

      import { SelectorError } from '#core/errors/selector-error.js';

      const error = new SelectorError({
      message: 'Ambiguous selector',
      attempted: 'Find single control',
      selectorString: 'sap.m.Button',
      });
      const context = error.toAIContext();
      // context.selectorString === 'sap.m.Button'
    • Serializes the error to a plain JSON-safe object.

      Returns SerializedPramanError & {
          parsedSelector: UI5Selector | undefined;
          selectorString: string | undefined;
      }

      Base serialized fields plus selectorString and parsedSelector.

      import { SelectorError } from '#core/errors/selector-error.js';

      const error = new SelectorError({
      message: 'Invalid selector',
      attempted: 'Parse selector string',
      selectorString: 'sap.m.Input',
      });
      const json = error.toJSON();
      // json.selectorString === 'sap.m.Input'
    • Formats the error for human-readable console output.

      Returns string

      Multi-line formatted string with all diagnostic sections.

      console.error(error.toUserMessage());