From 637532e05d8ed9a921b5de861cc7f463e96c6e04 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Mon, 29 Jan 2018 15:38:37 -0800 Subject: [PATCH] fix(init) ensure DAO init errors are correctly reported Since they are tables in the old DAO, this would fail with a super-sed: error "bad argument #2 to 'assert'" --- kong/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kong/init.lua b/kong/init.lua index 5e26d528e5a..4c3531bde35 100644 --- a/kong/init.lua +++ b/kong/init.lua @@ -157,7 +157,11 @@ function Kong.init() local config = assert(conf_loader(conf_path)) local dao = assert(DAOFactory.new(config)) -- instantiate long-lived DAO - assert(dao:init()) + local ok, err_t = dao:init() + if not ok then + error(tostring(err_t)) + end + assert(dao:are_migrations_uptodate()) -- populate singletons