diff --git a/control.lua b/control.lua index ab9e083f..90226fbb 100644 --- a/control.lua +++ b/control.lua @@ -11,13 +11,10 @@ Discord: https://discord.gg/r6dC2uK -- Replaces the base error function _error = error error = function(err) - if type(err) == 'table' then err = serpent.line(err) -- used factorio build in to avoid more errors - elseif type(err) ~= 'number' and type(err) ~= 'string' then err = tostring(err) - end verbose('Error Called: '..err) if _G.error_handle and type(error_handle) == 'function' then verbose('Exception Caught By Error Handle') - local success, _err = error_handle(err) + local success, _err = pcall(error_handle,err) if not success then _error({handle=_err,err=err}) end elseif _G.Game and game then verbose('Exception Caught By Game Print')