yodel/errors

Error types returned when loading, parsing, or accessing configuration.

Note: These types are re-exported from the main yodel module. Import them via import yodel rather than importing this module directly.

Types

Errors that can occur when loading configuration.

pub type ConfigError {
  FileError(FileError)
  ParseError(ParseError)
  ResolverError(ResolverError)
  ValidationError(ValidationError)
}

Constructors

Errors that occur when reading configuration files.

pub type FileError {
  FileNotFound(path: String)
  FilePermissionDenied(path: String)
  FileReadError(details: String)
  NotAFile(path: String)
}

Constructors

  • FileNotFound(path: String)
  • FilePermissionDenied(path: String)
  • FileReadError(details: String)
  • NotAFile(path: String)

Location of a syntax error in the source file.

pub type Location {
  Location(line: Int, column: Int)
}

Constructors

  • Location(line: Int, column: Int)

Errors that occur when parsing configuration content.

pub type ParseError {
  InvalidSyntax(SyntaxError)
  InvalidStructure(details: String)
  UnknownFormat
}

Constructors

  • InvalidSyntax(SyntaxError)
  • InvalidStructure(details: String)
  • UnknownFormat

Errors that occur when accessing configuration values.

pub type PropertiesError {
  PathNotFound(path: String)
  TypeError(path: String, error: TypeError)
}

Constructors

  • PathNotFound(path: String)
  • TypeError(path: String, error: TypeError)

Errors that occur when resolving environment variable placeholders.

pub type ResolverError {
  UnresolvedPlaceholder(placeholder: String, value: String)
  RegexError(details: String)
  NoPlaceholderFound
}

Constructors

  • UnresolvedPlaceholder(placeholder: String, value: String)
  • RegexError(details: String)
  • NoPlaceholderFound

Syntax errors with location information.

pub type SyntaxError {
  SyntaxError(
    format: String,
    location: Location,
    message: String,
  )
}

Constructors

  • SyntaxError(format: String, location: Location, message: String)

Type mismatch errors when accessing configuration values.

Contains the expected type and the actual value that was found.

pub type TypeError {
  ExpectedString(got: value.Value)
  ExpectedInt(got: value.Value)
  ExpectedFloat(got: value.Value)
  ExpectedBool(got: value.Value)
}

Constructors

Errors that occur during configuration validation.

pub type ValidationError {
  EmptyConfig
  InvalidConfig(details: String)
}

Constructors

  • EmptyConfig
  • InvalidConfig(details: String)

Values

pub fn format_config_error(error: ConfigError) -> String

Format a ConfigError into a human-readable string.

Search Document