-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
local deferred = require("deferred")
local d = deferred:new()
local function f1()
return d
end
local function f2()
return f1():next(
function(res)
return (res or "") .. "f2"
end,
function(err)
print("f2 err")
return err
end
)
end
local function f3()
return f2():next(
function(res)
return res .. "f3"
end,
function(err)
print("f3 err")
return err
end
)
end
f3():next(
function(res)
print("suc", res)
end,
function(err)
print("fail", err)
end
)
d:reject("fail error reject")Failure: fail error reject
suc f2f3
Tried both Lua 5.1.5 and 5.2.4, same results.
Even though I don't know if returning in error callback is the way to pass error to next stage, obviously error handling branch in f2() doesn't get called at all. Could you please explain this? Thanks.
Metadata
Metadata
Assignees
Labels
No labels