# ************************************************************* #
# Defines the error types raised during CODEMANIFEST processing #
# ************************************************************* #

Imports:
  - Types:
      - DocumentRoot
      - DocumentNode
    From: goga/ast/nodes

Usages:
  conventions: .goga/usages/conventions.md

Annotations: |
  When developing and testing: follow the practice `conventions`.

---

"BaseASTError(message: str)":
  location: base.py
  annotations: |
    Base exception for CODEMANIFEST processing errors.

    `message`: error text

    Requirements:
    - Must inherit from Exception
    - `message` must be passed into Exception.args
  properties:
    message -> str: |
      The message with which the error was created

"BaseASTError::DocumentNotFoundError(message: str)":
  location: document.py
  annotations: |
    Error raised when a document is not found.


"BaseASTError::DocumentParseError(message: str, filepath: str)":
  location: document.py
  annotations: |
    Error raised during document parsing.

    `message`: error text
    `filepath`: path to the file where the error occurred
  properties:
    filepath -> str: |
      Path to the file associated with the error

"BaseASTError::DocumentRuleError(message: str, rule: str, document: DocumentRoot, node: DocumentNode)":
  location: document.py
  annotations: |
    Error raised when a document-level rule is violated.

    `message`: error text
    `rule`: name of the violated rule
    `document`: document where the error occurred
    `node`: node where the error occurred

    Requirements:
    - The error must produce a string in the following format:
      ```
      Error: <message>
      Rule: <rule>
      Path: <document path without filename>
      Node:
        <beautiful node data>
      ```
  properties:
    rule -> str: |
      Name of the rule associated with the error
    document -> DocumentNode: |
      Document where the error occurred
    node -> DocumentNode: |
      Node associated with the error

"BaseASTError::ASTRuleError(message: str, rule: str, document: DocumentRoot | None, node: DocumentNode | None)":
  location: ast.py
  annotations: |
    Error raised when a tree-level rule is violated.

    `message`: error text
    `rule`: name of the violated rule
    `document`: document where the error occurred
    `node`: node where the error occurred

    Requirements:
    - The error must produce a string in the following format:
      ```
      Error: <message>
      Rule: <rule>
      Path: <document path without filename if document exists>
      Node:
        <beautiful node data if node exists>
      ```
  properties:
    rule -> str: |
      Name of the rule associated with the error
    document -> DocumentNode | None: |
      Document where the error occurred
    node -> DocumentNode | None: |
      Node associated with the error

---

Author: Mikhail Trifonov
CreatedAt: 11/04/26

Description: |
  Defines the error types raised during CODEMANIFEST processing.
