Actually handle errors correctly

This commit is contained in:
osmarks 2018-08-13 11:25:18 +01:00
parent 9f774cf169
commit 0462da1240

View File

@ -119,7 +119,8 @@ local function serve(fn, node_type)
local ok, result = pcall(fn, message.request)
if not ok then
response = errors.make(errors.INTERNAL, result)
if type(result) ~= "table" or not result.error then response = errors.make(errors.INTERNAL, result)
else response = result end
print("Error:", textutils.serialise(result)) -- show error
else
local end_time = os.clock()