diff --git a/code/modules/error_handler/error_handler.dm b/code/modules/error_handler/error_handler.dm index edae4c42ea..2cb432a739 100644 --- a/code/modules/error_handler/error_handler.dm +++ b/code/modules/error_handler/error_handler.dm @@ -7,12 +7,29 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0) // The ifdef needs to be down here, since the error viewer references total_runtimes #ifdef DEBUG /world/Error(var/exception/e, var/datum/e_src) + GLOB.total_runtimes++ //CHOMPEdit just moving this here to start counting right away if(!istype(e)) // Something threw an unusual exception log_error("\[[time_stamp()]] Uncaught exception: [e]") return ..() + + //CHOMP Edit Stealing this bit from TGS to try to record OOM issues. + //this is snowflake because of a byond bug (ID:2306577), do not attempt to call non-builtin procs in this if + if(copytext(E.name,1,32) == "Maximum recursion level reached") + //log to world while intentionally triggering the byond bug. + log_world("runtime error: [E.name]\n[E.desc]") + //if we got to here without silently ending, the byond bug has been fixed. + log_world("The bug with recursion runtimes has been fixed. Please remove the snowflake check from world/Error in [__FILE__]:[__LINE__]") + return //this will never happen. + + else if(copytext(E.name,1,18) == "Out of resources!") + log_world("BYOND out of memory.") + log_game("BYOND out of memory.") + return ..() + //CHOMP Edit end + if(!GLOB.error_last_seen) // A runtime is occurring too early in start-up initialization return ..() - GLOB.total_runtimes++ + var/erroruid = "[e.file][e.line]" var/last_seen = GLOB.error_last_seen[erroruid] @@ -115,4 +132,4 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0) else e.desc = " [extra_info]\n\n" + e.desc - world.Error(e, e_src) \ No newline at end of file + world.Error(e, e_src)