Error codes

E0241: bad fail argument

In a terminal: auk explain E0241 prints this page.

On this page

fail(e) returns an error from the function. In a T! function e is a str message or an Err; in a T!E function it must be a value of the error enum E.

Wrong#

auk
fn check(n: int): int! {
  if n < 0 { fail(n) }
  n
}

Fixed#

auk
fn check(n: int): int! {
  if n < 0 { fail("negative: {n}") }
  n
}

Common causes#

  • Failing with a number or other plain value: wrap it in a message.
  • A message in a T!E function: fail with a variant of E instead, e.g. fail(Bad(n)).

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page