diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-03-12 15:51:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-03-12 15:51:16 -0300 |
commit | c931d86e98da320c71da70c16d44aa28e9755520 (patch) | |
tree | 2c73ee84120f8f7983d883b3f46546e0676f6ba6 /testes | |
parent | d9e0f64a5de699a620771af299ea22f522c72f19 (diff) | |
download | lua-c931d86e98da320c71da70c16d44aa28e9755520.tar.gz lua-c931d86e98da320c71da70c16d44aa28e9755520.tar.bz2 lua-c931d86e98da320c71da70c16d44aa28e9755520.zip |
'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).
Diffstat (limited to '')
-rw-r--r-- | testes/errors.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testes/errors.lua b/testes/errors.lua index 8ef26757..d83e6023 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
@@ -46,7 +46,7 @@ end | |||
46 | assert(doit("error('hi', 0)") == 'hi') | 46 | assert(doit("error('hi', 0)") == 'hi') |
47 | 47 | ||
48 | -- test nil error message | 48 | -- test nil error message |
49 | assert(doit("error()") == "<error object is nil>") | 49 | assert(doit("error()") == "<no error object>") |
50 | 50 | ||
51 | 51 | ||
52 | -- test common errors/errors that crashed in the past | 52 | -- test common errors/errors that crashed in the past |
@@ -614,7 +614,7 @@ do | |||
614 | assert(not res and msg == t) | 614 | assert(not res and msg == t) |
615 | 615 | ||
616 | res, msg = pcall(function () error(nil) end) | 616 | res, msg = pcall(function () error(nil) end) |
617 | assert(not res and msg == "<error object is nil>") | 617 | assert(not res and msg == "<no error object>") |
618 | 618 | ||
619 | local function f() error{msg='x'} end | 619 | local function f() error{msg='x'} end |
620 | res, msg = xpcall(f, function (r) return {msg=r.msg..'y'} end) | 620 | res, msg = xpcall(f, function (r) return {msg=r.msg..'y'} end) |