diff --git a/src/box/lua/console.c b/src/box/lua/console.c index 8c0c69043dfc6f75a01956a759117581b985107d..cae8abd2a54ca306c1309431cf0655d778931f28 100644 --- a/src/box/lua/console.c +++ b/src/box/lua/console.c @@ -118,7 +118,17 @@ lbox_console_format_lua(struct lua_State *L) lua_replace(L, 1); lua_settop(L, 1); - return lua_encode(L, serializer_lua, &opts); + int ret = lua_encode(L, serializer_lua, &opts); + if (ret == 2) { + /* + * Nil and error object are pushed onto the stack. + */ + assert(lua_isnil(L, -2)); + assert(lua_isstring(L, -1)); + return luaL_error(L, lua_tostring(L, -1)); + } + assert(ret == 1); + return ret; } /* diff --git a/src/box/lua/serialize_lua.c b/src/box/lua/serialize_lua.c index 562d704c48600a8696881a0bdebe56f6d36ad411..a0ff771f8b7ebd5a4be3c4fdf96cca5fad6f7997 100644 --- a/src/box/lua/serialize_lua.c +++ b/src/box/lua/serialize_lua.c @@ -955,7 +955,7 @@ dump_root(struct lua_dumper *d) luaL_checkfield(d->L, d->cfg, lua_gettop(d->L), &nd.field); - if (nd.field.type != MP_ARRAY || nd.field.size != 1) { + if (nd.field.type != MP_ARRAY || nd.field.size > 1) { d->err = EINVAL; snprintf(d->err_msg, sizeof(d->err_msg), "serializer: unexpected data "