local function throw_if_true(param)
local ok, result = pcall(function()
if param then
error("test exception", 0)
end
return "done"
end)
if ok then
-- No error: result is the returned value
print("else: " .. result)
else
print("except")
end
end
throw_if_true(true)
-- except
throw_if_true(false)
-- else: done