webmcp

view framework/env/execute/_initializers.lua @ 425:beb1e7925a52

Stack traceback for "coro" (initializers/finalizers)
author jbe
date Tue Jan 12 20:03:17 2016 +0100 (2016-01-12)
parents a2c733535b8e
children c37d4bf50a4b
line source
1 function execute._initializers(initializer_path_element)
2 local yieldvalue_inner = {}
3 local coro = coroutine.create(function()
4 execute.multi_wrapped(
5 execute._create_sorted_execution_list(
6 function(add_by_path)
7 add_by_path(initializer_path_element)
8 add_by_path(WEBMCP_APP_NAME, initializer_path_element)
9 end,
10 function(full_path, relative_path)
11 execute.file_path{ file_path = full_path }
12 end
13 ),
14 function()
15 coroutine.yield(yieldvalue_inner)
16 end
17 )
18 end)
19 local success, yieldvalue = coroutine.resume(coro)
20 if not success then
21 error(debug.traceback(coro, "Error in initializer"))
22 end
23 if coroutine.status(coro) == "dead" then
24 error("Initializers failed to call execute.inner()")
25 elseif yieldvalue ~= yieldvalue_inner then
26 error("Unexpected yield in initializer")
27 end
28 execute._finalizers[#execute._finalizers+1] = function()
29 if not coroutine.resume(coro) then
30 error(debug.traceback(coro, "Error in finalizer"))
31 end
32 if coroutine.status(coro) ~= "dead" then
33 error("Unexpected yield in finalizer")
34 end
35 end
36 end

Impressum / About Us