ela
Contents

ManualLanguage

Error messages

In the terminalela --spec error-messages

An error is how a person or an AI agent learns ela, so its message is part of the language, held to the same care as the syntax.

  • Where: file:line:col: error: message, the form editors and agents already read. A script on stdin is stdin. An error in an imported file is at its own line, its path given from the folder ela runs in (lib/git.ela:4:8); ela --lint, whose findings are all in the script, puts it at the script's import with the file's place in the message (in lib/git.ela:4:8: …).
  • What, then what to write instead: the message names the rule that was broken and, wherever there is one, the ela way: "5" + 1 says to convert with int(...) or float(...); $? says to take the failure with err = try cmd; a glob that matches nothing says to quote it.
  • Bash habits are answered, not only refused: $1, $@, $!, $#, $? and other Bash forms get a message naming their ela replacement. A whole bash script is written as ela by ela --translate bash, which lists what it could not carry over (SHELL.md, From bash).
  • System errors in words: "no such file or directory", "permission denied", never a bare ENOENT.
  • Commands as typed. A command sees the name it was typed with, so its own errors say ls:, not /usr/bin/ls:.
  • A failed command says its name, its exit code and how to allow the failure (try); in a pipeline, which stage failed.
  • One error, the first: parsing and running stop at the first error, so the message is never buried under others it caused.
  • Every message is explained: ela --explain 'message' gives the rule behind any message ela can print, why ela has it, a wrong and a right way to write it, and the spec section to read (ela --spec <topic>); the start of a message, past its first value, is enough. ela --lint finds what it can without running anything, and ela --fmt lays a script out (Layout).

Where each of ela's errors comes from, from the script's text to the run, and where --check and --lint stop