mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
skynet.call capture error
This commit is contained in:
@@ -15,6 +15,10 @@ function command.EXIT()
|
||||
skynet.exit()
|
||||
end
|
||||
|
||||
function command.ERROR()
|
||||
error "throw an error"
|
||||
end
|
||||
|
||||
skynet.start(function()
|
||||
skynet.dispatch("lua", function(session,addr, cmd, ...)
|
||||
command[cmd](...)
|
||||
|
||||
@@ -3,6 +3,7 @@ local skynet = require "skynet"
|
||||
skynet.start(function()
|
||||
local ps = skynet.uniqueservice("pingserver")
|
||||
skynet.watch(ps)
|
||||
print(pcall(skynet.call,ps,"lua","ERROR"))
|
||||
print(skynet.call(ps, "lua", "PING", "hello"))
|
||||
skynet.send(ps, "lua", "EXIT")
|
||||
print(skynet.call(ps, "lua", "PING", "hay"))
|
||||
|
||||
Reference in New Issue
Block a user