mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
'luaD_seterrorobj' should not raise errors
This function can be called unprotected, so it should not raise any kind of errors. (It could raise a memory-allocation error when creating a message).
This commit is contained in:
parent
d9e0f64a5d
commit
c931d86e98
5 changed files with 25 additions and 22 deletions
|
|
@ -46,7 +46,7 @@ end
|
|||
assert(doit("error('hi', 0)") == 'hi')
|
||||
|
||||
-- test nil error message
|
||||
assert(doit("error()") == "<error object is nil>")
|
||||
assert(doit("error()") == "<no error object>")
|
||||
|
||||
|
||||
-- test common errors/errors that crashed in the past
|
||||
|
|
@ -614,7 +614,7 @@ do
|
|||
assert(not res and msg == t)
|
||||
|
||||
res, msg = pcall(function () error(nil) end)
|
||||
assert(not res and msg == "<error object is nil>")
|
||||
assert(not res and msg == "<no error object>")
|
||||
|
||||
local function f() error{msg='x'} end
|
||||
res, msg = xpcall(f, function (r) return {msg=r.msg..'y'} end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue