From f19fa6eb4710f25757098d6f8accdaac35eec5e1 Mon Sep 17 00:00:00 2001 From: 1F616EMO Date: Tue, 25 Jun 2024 19:07:12 +0800 Subject: [PATCH] Finish handling errors --- mods/default/functions.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 308488c0..461dcbe7 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -312,7 +312,18 @@ function default.dig_up(pos, node, digger, max_height) if up_node.name ~= node.name then break end - if not minetest.dig_node(up_pos, digger) then + local noerr, success = xpcall(function() + minetest.dig_node(up_pos, digger) + end, function(...) + in_dig_up = false + minetest.log("error", "Error raised during `default.dig_up` call:") + for line in debug.traceback(...):gmatch("([^\n]*)\n?") do + minetest.log("error", line) + end + end) + if not noerr then + error("Error raised during `default.dig_up` call") + elseif not success then break end end