diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index f14dfe0e45..944d2c7a77 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -159,19 +159,17 @@ function ENT:Execute(script, context) if not ok then local _catchable, msg, trace = E2Lib.unpackException(msg) - if msg == "exit" then - self:UpdatePerf(selfTbl) - elseif msg == "perf" then - local trace = context.trace or trace - + if msg == "perf" then + trace = context.trace or trace self:UpdatePerf(selfTbl) self:Error("Expression 2 (" .. selfTbl.name .. "): tick quota exceeded (at line " .. trace.start_line .. ", char " .. trace.start_col .. ")", "tick quota exceeded") - elseif trace then - self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") - else - local trace = context.trace or trace - - self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + elseif msg ~= "exit" then + if trace then + self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + else + trace = context.trace or trace + self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + end end end @@ -245,17 +243,17 @@ function ENT:ExecuteEvent(evt, args) if not ok then local _catchable, msg, trace = E2Lib.unpackException(msg) - if msg == "exit" then - self:UpdatePerf(selfTbl) - elseif msg == "perf" then - local trace = context.trace + if msg == "perf" then + trace = context.trace self:UpdatePerf(selfTbl) self:Error("Expression 2 (" .. selfTbl.name .. "): tick quota exceeded (at line " .. trace.start_line .. ", char " .. trace.start_col .. ")", "tick quota exceeded") - elseif trace then - self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") - else - local trace = context.trace - self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + elseif msg ~= "exit" then + if trace then + self:Error("Expression 2 (" .. selfTbl.name .. "): Runtime error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + else + trace = context.trace + self:Error("Expression 2 (" .. selfTbl.name .. "): Internal error '" .. msg .. "' at line " .. trace.start_line .. ", char " .. trace.start_col, "script error") + end end end