@hrefcl/apidoc - v4.0.5
    Preparing search index...

    Specialized error class for worker process errors during API documentation parsing

    WorkerError extends the base Error class to provide detailed context about parsing failures, including file location, block information, and usage examples. This helps developers quickly identify and fix documentation syntax issues.

    throw new WorkerError(
    'Invalid parameter syntax',
    'src/api/users.js',
    '15',
    '@apiParam',
    '@apiParam {String} name',
    '@apiParam {String} name User name',
    { line: 15, column: 10 }
    );
    try {
    // Parse API documentation
    } catch (error) {
    if (error instanceof WorkerError) {
    console.error(`Error in ${error.file} at block ${error.block}`);
    console.error(`Element: ${error.element}`);
    console.error(`Usage: ${error.definition}`);
    }
    }

    4.0.0

    Hierarchy

    • Error
      • WorkerError
    Index

    Constructors

    • Creates a new WorkerError with detailed context information

      Parameters

      • message: string

        Primary error message describing what went wrong

      • file: string

        Source file path where the error occurred

      • block: string

        Block identifier, line number, or position in the file

      • element: string

        API documentation element that caused the error

      • definition: string

        Correct syntax/usage for the element

      • example: string

        Example showing proper usage of the element

      • Optionalextra: any

        Additional context like line/column numbers, validation details

      Returns WorkerError

      throw new WorkerError(
      'Missing parameter type',
      'src/controllers/user.js',
      '42',
      '@apiParam',
      '@apiParam {Type} name Description',
      '@apiParam {String} username User login name',
      { line: 42, column: 15, found: '{} name' }
      );

    Properties

    file: string

    Source file where the error occurred

    block: string

    Block identifier or line number where the error occurred

    element: string

    API documentation element that caused the error (e.g., '@apiParam')

    definition: string

    Correct usage definition for the element

    example: string

    Example of correct usage

    extra: any

    Additional error context (line numbers, validation details, etc.)