molt/error

Types

pub type MoltError {
  ParseError(message: String, offset: Int)
  InvalidSourceEncoding
  InvalidPath(message: String)
  ValueParseError(expected: option.Option(String), text: String)
  InvalidDocument
  NotFound(path: String, at: String)
  AlreadyExists(path: String, current: @internal IndexEntry)
  IndexOutOfRange(path: String, index: Int, length: Int)
  ValueIndexOutOfRange(index: Int, length: Int)
  ValueKeyNotFound(key: String)
  TypeMismatch(
    path: option.Option(String),
    expected: String,
    got: String,
  )
  InvalidTomlValue(path: String, text: String)
  InvalidOperation(
    operation: String,
    reason: option.Option(String),
  )
  UpdateError(message: String)
}

Constructors

  • ParseError(message: String, offset: Int)

    Parsing failed without a chance of recovery: invalid control characters, null bytes, etc.

  • InvalidSourceEncoding

    The source encoding of the document in a BitArray to be parsed is not UTF-8.

  • InvalidPath(message: String)

    Could not parse a document path for the reason quoted.

  • ValueParseError(expected: option.Option(String), text: String)

    Could not parse the text into a TOML Value.

  • InvalidDocument

    The document has validation errors that must be fixed prior to the use of molt high-level functions.

  • NotFound(path: String, at: String)

    Nothing can be found at the requested path.

    If at differs from path, it indicates where path resolution stopped (the deepest path prefix that exists).

  • AlreadyExists(path: String, current: @internal IndexEntry)

    There is an item at path that already exists preventing the creation of a new item at that path.

  • IndexOutOfRange(path: String, index: Int, length: Int)

    An index in a path reference resolves to a position where no array element exists in the document.

    This is raised on the resolved index, so that a[-3] in a five element array is equivalent to a[2].

  • ValueIndexOutOfRange(index: Int, length: Int)

    An index in a path reference resolves to a position where no element exists in the array Value.

    This is raised on the resolved index, so that -3 in a five element array is equivalent to 2.

  • ValueKeyNotFound(key: String)

    There is no key of the name provided in a table-like value.

  • TypeMismatch(
      path: option.Option(String),
      expected: String,
      got: String,
    )

    A type mismatch for the path, where we expected one type but got another.

  • InvalidTomlValue(path: String, text: String)

    An invalid TOML value token was passed to an operation.

  • InvalidOperation(
      operation: String,
      reason: option.Option(String),
    )

    The operation cannot be applied.

  • UpdateError(message: String)

    An update error that is generated by the caller of an Update operation callback. Users should return this via molt.update_error.

Values

pub fn describe_error(error: MoltError) -> String

Describe an error as a human-readable string.

Search Document