OxL Reference

data TraceFrame

One frame of an error trace: the function containing the ?, its file and line.

Example:

oxl✓ checked in CI
@error data Boom {}

fn inner() -> () | Boom {
  fail Boom{}
}

fn outer() -> () | Boom {
  inner()?
}

fn main() io {
  match outer() {
    Boom b => {
      let f = b.trace()[0]
      print("{f.r#fn} {f.line > 0}")
    }
    _ => {}
  }
}
Output
outer true
pub(api) data TraceFrame

Since. 1.0.0-beta

Fields

pub(api) r#fn: str

Name of the function that contains the ?.

pub(api) file: str

Source file.

pub(api) line: i64

Line of the ?.

Defined in: std/core/types.oxl:981

See also