Skip to content

Error Codes Reference

Auto-generated from src/util/diagnostic/codes/

The YaoXiang compiler uses a unified error code system, where each error code contains:

  • Code: Error identifier (e.g., E1001)
  • Category: Compilation phase the error belongs to
  • Title: Short description of the error
  • Message: Detailed error message
  • Help: Possible solutions

Error Code List

PrefixCategoryDescription
E0xxxLexer/ParserLexer and parser errors
E1xxxTypeCheckType checking errors
E2xxxSemanticSemantic analysis errors
E4xxxGenericGenerics and trait errors
E5xxxModuleModule and import errors
E6xxxRuntimeRuntime errors
E7xxxI/OI/O and system errors
E8xxxInternalInternal compiler errors

Usage

CLI Commands

Use the yaoxiang explain command to view error details:

bash
# View error details
yaoxiang explain E1001

# JSON format output
yaoxiang explain E1001 --json

In Code

rust
use yaoxiang::util::diagnostic::{ErrorCodeDefinition, I18nRegistry};

// Find the error code and retrieve title and help info via I18nRegistry
let i18n = I18nRegistry::default();

if let Some(code) = ErrorCodeDefinition::find("E1001") {
    let title = i18n.get_title(&code);
    println!("Title: {}", title);

    if let Some(help) = i18n.get_help(&code) {
        println!("Help: {}", help);
    }
}