From 7964f7cbbdae9c9af6bc3c6d01e88eab5eafebd5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 10 Feb 2003 08:21:31 -0200 Subject: more complete information for coroutine errors --- lbaselib.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index 4c49f5eb..ce5e442f 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.115 2002/12/06 17:05:15 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.116 2002/12/20 09:55:56 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -573,7 +573,14 @@ static int luaB_coresume (lua_State *L) { static int luaB_auxwrap (lua_State *L) { lua_State *co = lua_tothread(L, lua_upvalueindex(1)); int r = auxresume(L, co, lua_gettop(L)); - if (r < 0) lua_error(L); /* propagate error */ + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } return r; } -- cgit v1.2.3-55-g6feb