webmcp

view framework/env/execute/_initializers.lua @ 449:c37d4bf50a4b

Pass error string of coroutine in execute._initializers
author jbe
date Thu Jul 21 12:43:30 2016 +0200 (2016-07-21)
parents beb1e7925a52
children
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, value = coroutine.resume(coro)
20 if not success then
21 error(debug.traceback(coro, "Error in initializer: " .. tostring(value)))
22 end
23 if coroutine.status(coro) == "dead" then
24 error("Initializers failed to call execute.inner()")
25 elseif value ~= yieldvalue_inner then
26 error("Unexpected yield in initializer")
27 end
28 execute._finalizers[#execute._finalizers+1] = function()
29 local success, value = coroutine.resume(coro)
30 if not success then
31 error(debug.traceback(coro, "Error in finalizer: " .. tostring(value)))
32 end
33 if coroutine.status(coro) ~= "dead" then
34 error("Unexpected yield in finalizer")
35 end
36 end
37 end

Impressum / About Us