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

    Class VocabularyError

    Error subclass for business vocabulary resolution failures.

    Thrown when a business vocabulary term cannot be resolved, a domain vocabulary file fails to load, or a term maps ambiguously to multiple SAP controls or actions. Includes the term and domain fields for diagnostic context.

    cross-module

    Business vocabulary resolution for SAP domain terms

    Term not found — vocabulary term has no registered definition

    Domain load failed — vocabulary JSON file could not be loaded

    Ambiguous match — term maps to multiple SAP controls or actions

    Vocabulary term suggestions for AI — nearestTerms field provides alternatives

    const error = new VocabularyError({
    message: 'Term not found in procurement domain',
    attempted: 'Resolve vocabulary term: vendorNumber',
    term: 'vendorNumber',
    domain: 'procurement',
    suggestions: ['Check spelling — did you mean "vendor"?'],
    });

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new VocabularyError instance.

      Parameters

      • options: VocabularyErrorOptions

        Vocabulary error construction options including the optional term and domain diagnostic fields. Defaults: code = ERR_VOCAB_TERM_NOT_FOUND, retryable = false.

      Returns VocabularyError

      import { VocabularyError } from '#core/errors/vocabulary-error.js';

      const error = new VocabularyError({
      message: 'Term "vendorNum" not found in procurement domain',
      attempted: 'Resolve business term: vendorNum',
      term: 'vendorNum',
      domain: 'procurement',
      suggestions: [
      'Did you mean "vendorNumber"?',
      'Use getBusinessTermSuggestions() to list available terms',
      ],
      });

    Properties

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

    Methods

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

      Returns AIErrorContext & { domain: string | undefined; term: string | undefined }

      AI-friendly context object with vocabulary diagnostic fields.

      Extends the base AI context with term and domain so AI agents can suggest alternative business terms or correct domain references.

      import { VocabularyError } from '#core/errors/vocabulary-error.js';

      const error = new VocabularyError({
      message: 'Ambiguous term matches 2 controls',
      attempted: 'Resolve term: amount',
      code: 'ERR_VOCAB_AMBIGUOUS_MATCH',
      term: 'amount',
      domain: 'sales',
      });
      const context = error.toAIContext();
      // context.term === 'amount', context.domain === 'sales'
    • Serializes the error to a plain JSON-safe object.

      Returns SerializedPramanError & { domain: string | undefined; term: string | undefined }

      Base serialized fields plus term and domain.

      import { VocabularyError } from '#core/errors/vocabulary-error.js';

      const error = new VocabularyError({
      message: 'Term not found',
      attempted: 'Resolve term: vendor',
      term: 'vendor',
      domain: 'procurement',
      });
      const json = error.toJSON();
      // json.term === 'vendor', json.domain === 'procurement'
    • Formats the error for human-readable console output.

      Returns string

      Multi-line formatted string with all diagnostic sections.

      console.error(error.toUserMessage());