Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, alexander.turenko@tarantool.org
Subject: [Tarantool-patches] [PATCH 1/4] box: improve built-in module load panic message
Date: Sun, 12 Apr 2020 22:13:27 +0200	[thread overview]
Message-ID: <4c318477f31ba41d213a70ac75370016fcef0d9f.1586722379.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1586722379.git.v.shpilevoy@tarantool.org>

Box built-in modules, such as session, tuple, schema, etc, were
loaded using luaL_loadbuffer() + lua_call(). Error of the former
call was handled properly with a panic message describing the
problem.

But if lua_call() failed, it resulted into 'unknown exception' in
main.cc. Not very helpful. Now it is lua_pcall(), and the error
message is included into the panic() message. That helps in debug,
when something is being changed in the box modules.
---
 src/box/lua/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/box/lua/init.c b/src/box/lua/init.c
index 63e8b8216..9db740de6 100644
--- a/src/box/lua/init.c
+++ b/src/box/lua/init.c
@@ -432,10 +432,10 @@ box_lua_init(struct lua_State *L)
 		const char *modsrc = *(s + 1);
 		const char *modfile = lua_pushfstring(L,
 			"@builtin/%s.lua", modname);
-		if (luaL_loadbuffer(L, modsrc, strlen(modsrc), modfile))
+		if (luaL_loadbuffer(L, modsrc, strlen(modsrc), modfile) != 0 ||
+		    lua_pcall(L, 0, 0, 0) != 0)
 			panic("Error loading Lua module %s...: %s",
 			      modname, lua_tostring(L, -1));
-		lua_call(L, 0, 0);
 		lua_pop(L, 1); /* modfile */
 	}
 
-- 
2.21.1 (Apple Git-122.3)

  reply	other threads:[~2020-04-12 20:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12 20:13 [Tarantool-patches] [PATCH 0/4] CMake option to remove feedback daemon Vladislav Shpilevoy
2020-04-12 20:13 ` Vladislav Shpilevoy [this message]
2020-04-12 20:13 ` [Tarantool-patches] [PATCH 2/4] feedback: move feedback code to the single file Vladislav Shpilevoy
2020-04-12 20:13 ` [Tarantool-patches] [PATCH 3/4] box: yield after initial box_cfg() is finished Vladislav Shpilevoy
2020-04-12 20:13 ` [Tarantool-patches] [PATCH 4/4] feedback: add cmake option to disable the daemon Vladislav Shpilevoy
2020-04-15 17:28   ` Serge Petrenko
2020-04-15 20:04     ` Vladislav Shpilevoy
2020-04-12 20:19 ` [Tarantool-patches] [PATCH 0/4] CMake option to remove feedback daemon Vladislav Shpilevoy
2020-04-17  7:04 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c318477f31ba41d213a70ac75370016fcef0d9f.1586722379.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/4] box: improve built-in module load panic message' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox