Esc

Time_Error

structextensionsince 0.36.1Source
  • macOS: Time_Error works on macOS
  • Linux: Time_Error works on Linux
  • Windows: Time_Error works on Windows
  • Wasm: Time_Error works on Wasm

Declaration

Time_Error :: struct {
    kind: Time_Error_Kind;    message: string;    offset: s64 = -1;}

Static message and zero-based parse byte offset (-1 for other errors). No error owns memory. Failed results must not be used.

Example↗
_, error := parse(Date, "2024/02-29");
assert(error.kind == .SYNTAX && error.offset == 4);
_, invalid := date(2023, 2, 29);
assert(invalid.offset == -1); // only parse errors carry an offset

See also