Errors and Debugging

Error values

Use error() for an empty error value and error("message") for a populated one.

err = error()
if err != error():
    print("has error")

Raise a fatal runtime error

Use raiseErr(message) when execution must stop immediately.

fuc require_non_empty(s: str) -> void:
    if s == "":
        raiseErr("input cannot be empty")

raiseErr is fatal and reports a stack trace with function context.

Common error cases

Type mismatch after variable lock:

value = 10
# value = "ten"  # runtime type error

Non-bool condition:

# if 1:  # invalid, condition must be bool
#     print("x")

Wrong function argument type:

fuc add(a: int, b: int) -> int:
    return a + b

# add("1", 2)  # runtime type error

Debug workflow

  1. Run with type-check first:

./ajasendiri check your_file.aja
  1. Run in debugger mode when needed:

./ajasendiri debug your_file.aja
  1. Add small prints around suspected values/types.

  2. Reduce failing code to a minimal reproducible snippet.