caffeine_lang/errors

Types

Represents top level compilation errors.

pub type CompilationError {
  FrontendParseError(msg: String, context: ErrorContext)
  FrontendValidationError(msg: String, context: ErrorContext)
  LinkerValueValidationError(msg: String, context: ErrorContext)
  LinkerDuplicateError(msg: String, context: ErrorContext)
  LinkerParseError(msg: String, context: ErrorContext)
  LinkerVendorResolutionError(msg: String, context: ErrorContext)
  SemanticAnalysisTemplateParseError(
    msg: String,
    context: ErrorContext,
  )
  SemanticAnalysisTemplateResolutionError(
    msg: String,
    context: ErrorContext,
  )
  SemanticAnalysisDependencyValidationError(
    msg: String,
    context: ErrorContext,
  )
  GeneratorSloQueryResolutionError(
    msg: String,
    context: ErrorContext,
  )
  GeneratorTerraformResolutionError(
    vendor: String,
    msg: String,
    context: ErrorContext,
  )
  CQLResolverError(msg: String, context: ErrorContext)
  CQLParserError(msg: String, context: ErrorContext)
  CompilationErrors(errors: List(CompilationError))
}

Constructors

  • FrontendParseError(msg: String, context: ErrorContext)
  • FrontendValidationError(msg: String, context: ErrorContext)
  • LinkerValueValidationError(msg: String, context: ErrorContext)
  • LinkerDuplicateError(msg: String, context: ErrorContext)
  • LinkerParseError(msg: String, context: ErrorContext)
  • LinkerVendorResolutionError(msg: String, context: ErrorContext)
  • SemanticAnalysisTemplateParseError(
      msg: String,
      context: ErrorContext,
    )
  • SemanticAnalysisTemplateResolutionError(
      msg: String,
      context: ErrorContext,
    )
  • SemanticAnalysisDependencyValidationError(
      msg: String,
      context: ErrorContext,
    )
  • GeneratorSloQueryResolutionError(
      msg: String,
      context: ErrorContext,
    )
  • GeneratorTerraformResolutionError(
      vendor: String,
      msg: String,
      context: ErrorContext,
    )
  • CQLResolverError(msg: String, context: ErrorContext)
  • CQLParserError(msg: String, context: ErrorContext)
  • CompilationErrors(errors: List(CompilationError))

Machine-readable error code for diagnostic output.

pub type ErrorCode {
  ErrorCode(phase: String, number: Int)
}

Constructors

  • ErrorCode(phase: String, number: Int)

Structured context attached to every compilation error.

pub type ErrorContext {
  ErrorContext(
    identifier: option.Option(String),
    source_path: option.Option(String),
    source_content: option.Option(String),
    location: option.Option(SourceLocation),
    suggestion: option.Option(String),
  )
}

Constructors

A source location within a file (1-indexed).

pub type SourceLocation {
  SourceLocation(
    line: Int,
    column: Int,
    end_column: option.Option(Int),
  )
}

Constructors

  • SourceLocation(
      line: Int,
      column: Int,
      end_column: option.Option(Int),
    )

Values

pub fn cql_parser_error(msg msg: String) -> CompilationError

Creates a CQLParserError with empty context.

pub fn cql_resolver_error(msg msg: String) -> CompilationError

Creates a CQLResolverError with empty context.

pub fn empty_context() -> ErrorContext

Returns an ErrorContext with all fields set to None.

pub fn error_code_for(error: CompilationError) -> ErrorCode

Assigns an error code based on the CompilationError variant.

pub fn error_code_to_string(code: ErrorCode) -> String

Converts an ErrorCode to its display string (e.g., “E103”).

pub fn frontend_parse_error(msg msg: String) -> CompilationError

Creates a FrontendParseError with empty context.

pub fn frontend_validation_error(
  msg msg: String,
) -> CompilationError

Creates a FrontendValidationError with empty context.

pub fn generator_slo_query_resolution_error(
  msg msg: String,
) -> CompilationError

Creates a GeneratorSloQueryResolutionError with empty context.

pub fn generator_terraform_resolution_error(
  vendor vendor: String,
  msg msg: String,
) -> CompilationError

Creates a GeneratorTerraformResolutionError with empty context.

pub fn linker_duplicate_error(
  msg msg: String,
) -> CompilationError

Creates a LinkerDuplicateError with empty context.

pub fn linker_parse_error(msg msg: String) -> CompilationError

Creates a LinkerParseError with empty context.

pub fn linker_value_validation_error(
  msg msg: String,
) -> CompilationError

Creates a LinkerValueValidationError with empty context.

pub fn linker_vendor_resolution_error(
  msg msg: String,
) -> CompilationError

Creates a LinkerVendorResolutionError with empty context.

pub fn semantic_analysis_dependency_validation_error(
  msg msg: String,
) -> CompilationError

Creates a SemanticAnalysisDependencyValidationError with empty context.

pub fn semantic_analysis_template_parse_error(
  msg msg: String,
) -> CompilationError

Creates a SemanticAnalysisTemplateParseError with empty context.

pub fn semantic_analysis_template_resolution_error(
  msg msg: String,
) -> CompilationError

Creates a SemanticAnalysisTemplateResolutionError with empty context.

Search Document