envie/error

Types

An error accessing or decoding a single environment variable.

pub type Error {
  Missing(name: String)
  InvalidValue(name: String, value: String, reason: String)
  DecodeError(name: String, details: String)
}

Constructors

  • Missing(name: String)

    The variable does not exist in the environment.

  • InvalidValue(name: String, value: String, reason: String)

    The variable exists but its value failed validation or decoding.

  • DecodeError(name: String, details: String)

    A generic decode failure with freeform details.

An error that occurs when loading a .env file.

pub type LoadError {
  FileNotFound(path: String)
  ReadError(path: String, reason: String)
  ParseError(errors: List(ParseError))
}

Constructors

  • FileNotFound(path: String)

    The requested file was not found on disk.

  • ReadError(path: String, reason: String)

    The file was found but could not be read.

  • ParseError(errors: List(ParseError))

    The file was read but contained syntax errors.

A single syntax error found while parsing a .env file.

pub type ParseError {
  InvalidSyntax(line: Int, content: String, reason: String)
  InvalidEscape(line: Int, sequence: String)
}

Constructors

  • InvalidSyntax(line: Int, content: String, reason: String)

    A line that does not follow the KEY=value format.

  • InvalidEscape(line: Int, sequence: String)

    An unrecognized escape sequence inside a quoted value.

Values

pub fn format(error: Error) -> String

Format a single Error into a human-readable message.

pub fn format_all(errors: List(Error)) -> String

Format a list of Error values, one per line.

pub fn format_load_error(error: LoadError) -> String

Format a LoadError into a human-readable message.

pub fn format_parse_errors(errors: List(ParseError)) -> String

Format a list of ParseError values, one per line.

Search Document