# 01 · error-levels **演示**:`error("boom", 0)` 不带位置;`level=2` 把位置指向调用者。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/20-error-handling/01-error-levels .tools/bin/lua54 scripts/test-example.lua examples/20-error-handling/01-error-levels ``` **预期输出**(lua 5.4.9 / macOS arm64;路径随环境): ```text zero=boom one=main.lua:6: boom two=main.lua:10: boom ``` **看点**:`level=1` 指向 error 所在行,`2` 指向调用 fail 的行。 **注意**:消息内容与文件路径随加载方式变化,不要写死完整路径。