lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, May 20, 2020 at 3:36 PM Ahmed Charles <acharles@outlook.com> wrote:

> The issue with raise/throw is that those tend to imply that a catch happens after

The word "raise" is the one already used in the manual, even though it is not formally introduced in section 2.3, where it says "generate an error" (this and following from the Lua 5.3 manual). The word "catch" is also used, but much less frequently. I'd say it is really section 2.3 where confusion starts, because it starts by saying "Whenever an error occurs during the compilation or execution of a Lua chunk, control returns to the host", which is technically wrong, and is contradicted two sentences later: "If you need to catch errors in Lua, you can use pcall".

I'd say section 2.3 should formally introduce the terms "raise" and "catch", and explain consistently what they mean. Then the manual entry for "error" can just say "raises [message] as an error".

Cheers,
V.