Skip to content
Snippets Groups Projects
Commit 3b44e263 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

lua-box-error: export error ids to the box.error table.

parent 8213d07c
No related branches found
No related tags found
No related merge requests found
......@@ -1334,6 +1334,20 @@ tarantool_lua_register_type(struct lua_State *L, const char *type_name,
lua_pop(L, 1);
}
static const struct luaL_reg errorlib [] = {
{NULL, NULL}
};
static void
tarantool_lua_error_init(struct lua_State *L) {
luaL_register(L, "box.error", errorlib);
for (int i = 0; i < tnt_error_codes_enum_MAX; i++) {
lua_pushnumber(L, i);
lua_setfield(L, -2, tnt_error_codes[i].errstr);
}
lua_pop(L, 1);
}
struct lua_State *
tarantool_lua_init()
{
......@@ -1370,6 +1384,7 @@ tarantool_lua_init()
tarantool_lua_uuid_init(L);
tarantool_lua_socket_init(L);
tarantool_lua_session_init(L);
tarantool_lua_error_init(L);
mod_lua_init(L);
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment